Menu Event on the "TAB" top ? Only click works ?

Post

Posted
Rating:
#1 (In Topic #1298)
Regular
sergioabreu is in the usergroup ‘Regular’
I want to fire Menu event but on the tab caption region.

It seems that only CLICK event works there and I didn't find access to mouse button on click event .
If there is a Menu Event for STRIPTAB, we expect it works also on the part of the tab where the text is, as the CLICK event works there.

Anyone knows how to solve it?

Thanks
Online now: No Back to the top

Post

Posted
Rating:
#2
Avatar
Guru
cogier is in the usergroup ‘Guru’
This code works with gb.gui.qt but not with gb.gui, why that is, I don't know!

Code (gambas)

  1. TabStrip1 As TabStrip
  2. hMenu As Menu
  3.  
  4. Public Sub Form_Open()
  5.  
  6.   With Me
  7.     .Arrangement = Arrange.Vertical
  8.     .H = 512
  9.     .W = 512
  10.     .Padding = 5
  11.  
  12.   SetUpMenu
  13.  
  14.   With Tabstrip1 = New TabStrip(Me) As "TabStrip1"
  15.     .Expand = True
  16.     .Count = 5
  17.     .PopupMenu = "MyMenu"
  18.  
  19.  
  20. Public Sub SetUpMenu()
  21.  
  22.   Dim hMenuItem As Menu
  23.   Dim sTemp As String
  24.   Dim sMenuName As String[] = ["One", "Two", "Three", "Four"]
  25.  
  26.   hMenu = New Menu(Me) As "MyMenu"
  27.   hMenu.Text = "&Main menu"
  28.  
  29.   For Each sTemp In sMenuName
  30.     hMenuItem = New Menu(hMenu) As "MyMenu"
  31.     hMenuItem.text = "&" & sTemp
  32.     hMenuItem.name = sTemp
  33.   Next
  34.  
  35.  
Online now: No Back to the top

Post

Posted
Rating:
#3
Guru
BruceSteers is in the usergroup ‘Guru’
See what you can do with  _GetButton(Index)

The tabs part of tabpanel/tabstrip are not that accessible only the panel contents

but the hidden method _GetButton() gets a particular TabPanelButton button object comp/src/gb.form/.src/TabPanel/_TabPanelButton.class · master · Gambas / gambas · GitLab

you can set various properties and also create an Observer to watch the button for events…

Something like this…

Code (gambas)

  1.  
  2.  
  3. Public Sub Form_Open()
  4.  
  5. ' make an Observer using the name TabBut, the TabBut_xxx events will fire "before" the tab uses them itself, you can cancel it's default usage with "Stop Event"
  6.   $hObs = New Observer(TabPanel1._GetButton(0)) As "TabBut"
  7.  
  8. ' A handy trick to set individual Tooltip for each tab button..
  9. TabPanel1._GetButton(0).Tooltip = "My custom panel button tooltip"
  10.  
  11.  
  12. Public Sub TabBut_MouseUp()
  13.  
  14.  
  15.   Dim iIndex As Integer = TabPanel1.Index  ' the current panel index
  16.  
  17.     Stop Event  
  18.     hAlternativeMenu.Popup()
  19.     Return
  20.  
  21.  
  22.  
Online now: No Back to the top
1 guest and 0 members have just viewed this.