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

Re: TabPanel Click event (or workaround) wanted



On 27/9/24 9:32 pm, Bruce Steers wrote:


On Fri, 27 Sept 2024 at 12:38, BB <adamnt42@xxxxxxxxx <mailto:adamnt42@xxxxxxxxx>> wrote:


    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  <http://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


how about something like this then...
I use a private variable $iTabDown to note the tab index on MouseDown (before index changes)

then in the MouseUp event if $iTabDown is the same i fire the Click event thus fixing your issue :)

I guess the TabPanel_Click event is technically misnamed and should really be called _Change because it only fires on a Change not on a Click

Respects
BruceS

There is no Click event, only Activated. Which doesn't occur if there is only one TabPanel1."panel" open. I've had a look at your demo and I'll be damned if I can understand why you can "TabPanel1._GetButton(0)" and I cant.

At least tomorrow is the AFL Grand Final, so I wont need to think about this for at least 24 hours. Unless the mighty Swans dont emerge triumphant, in which case I will be extremely grumpy for at least a month.


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>
Re: TabPanel Click event (or workaround) wantedBB <adamnt42@xxxxxxxxx>
Re: TabPanel Click event (or workaround) wantedBruce Steers <bsteers4@xxxxxxxxx>