[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: TabPanel Click event (or workaround) wanted



On 27/9/24 7:59 pm, Bruce Steers wrote:
here's the class
https://gitlab.com/gambas/gambas/-/blob/master/comp/src/gb.form/.src/TabPanel/_TabPanelButton.class?ref_type=heads <https://gitlab.com/gambas/gambas/-/blob/master/comp/src/gb.form/.src/TabPanel/_TabPanelButton.class?ref_type=heads>

aah i see the TabButton has a DrawingArea as its first child

I just tested this and it works..

 Public Sub Form_Open()

 Dim $hObs As Observer
 $hObs = New Observer(TabPanel1._GetButton(0).Children[0]) As "BTN"

End

Public Sub BTN_MouseUp()

  Debug "mouseup"

End

respects
BruceS

Where are you putting this? In the main form code or the form code used in the TabPanel?

This is infuriatingly close. I have the observer in the main form Open...

  Dim $hObs As Observer
  $hObs = New Observer(tabEditors.TabPanel._GetButton(0).Children[0]) As "BTN"

and the handler as

Public Sub BTN_MouseUp()
  Debug "mouseup"
  Debug tabEditors.TabPanel.Current.Text
  AutoClick(tabEditors.TabPanel.Current.thisDATObj.Name)
End

and the BTN_MouseUp handler is invoked (yay! and thanks) but now my problem is that the tabEditors.TabPanel.Current.Text is available BUT there is a property exposed in my form, "thisDATObj", that I need to get at and I cant see it in the debugger. Nor can I get it, as in

  tabEditors.TabPanel.Current.thisDATObj.Translation

which is the property I need to resynch the treeview.


As expressed elsewhere very recently "Why is this so @$^$%@ complicated?"

It would be a lot simpler if the damned TabPanel had a Click event.

Here's my thinking.
The main form, the TabPanel (in my case "tabEditors") knows about its panels. A panel cannot exist unless it has something in it (cant it?) So that something should be accessible in its own right, as in "tabEditors.Content" which must be a Form object surely. I cant see how it would be possible to put anything else in there. Fine. It also has a "header" in other words not the content but the widget at the top (or wherever). Both of these are different things. A click on the content should set the focus on something in the content and continue whereas a click on the "header" is an entirely different "event" but the "content" should be available in the handler. That's my theory anyway.

I think I need to lie down for a little while, again.

b


Follow-Ups:
Re: TabPanel Click event (or workaround) wantedBruce Steers <bsteers4@xxxxxxxxx>
References:
TabPanel Click event (or workaround) wantedBB <adamnt42@xxxxxxxxx>
Re: TabPanel Click event (or workaround) wantedBruce Steers <bsteers4@xxxxxxxxx>
Re: TabPanel Click event (or workaround) wantedBB <adamnt42@xxxxxxxxx>
Re: TabPanel Click event (or workaround) wantedBruce Steers <bsteers4@xxxxxxxxx>