borodust / bodge-ui

High-level immediate mode user interface library based on Nuklear IM GUI library
MIT License
15 stars 1 forks source link

tab/notebook broken by click-listeners not generated #16

Open Giels opened 4 years ago

Giels commented 4 years ago

As the title says. My current workaround is to manually add the missing click-listeners as follows:

Given a layout like

(defpanel
 (notebook :name :notebook
  (tab :label "Hello"
   (label :text "Hi"))
 (tab :label "World"
  (label :text "everyone"))))

I add

(defmethod bodge-ui-window:on-ui-ready ((this main-window))
  (let* ((main-panel  (first (bodge-ui::%panels-of (bodge-ui-window:ui-window-context this))))
          (notebook (bodge-ui:find-element :notebook main-panel)))
    (loop for tab-btn in (bodge-util:children-of (slot-value notebook 'bodge-ui::tabbar))
      for idx from 0 do
      (setf (slot-value tab-btn 'bodge-ui::click-listener) (funcall (lambda (idx) (lambda (panel) (bodge-ui::select-tab notebook idx))) idx)))))

(using bodge-ui-window to take care of the boilerplate, not shown).

borodust commented 4 years ago

Well, whole notebook thing is actually WIP. I didn't finish it yet. Shouldn't have merged it, I agree :) Just in case, bodge-ui is kinda alpha-quality.

Giels commented 4 years ago

Yeah, I'm aware it's still WIP. It's still good enough in its current state to get a basic UI working in no time, which is great (the state of qtools et al., for example, isn't quite as interesting...) I figured noting what's currently broken/missing as I play around with it might be useful, but let me know if you'd rather wait until bodge-ui is more mature first.

borodust commented 4 years ago

I see, thanks a bunch! Feedback is very welcome. Feel free to poke around and fire up all the issues you find. I just wasn't sure if you wanted it GA quality or just checking it out.