TabBarGadget - Tabs like in a browser

Share your advanced PureBasic knowledge/code with the community.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5353
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: TabBarGadget - Tabs like in a browser

Post by Kwai chang caine »

Wonderfull STARGATE thanks for sharing :shock:
ImageThe happiness is a road...
Not a destination
Poshu
Enthusiast
Enthusiast
Posts: 459
Joined: Tue Jan 25, 2005 7:01 pm
Location: Canada

Re: TabBarGadget - Tabs like in a browser

Post by Poshu »

STARGÅTE wrote:In the current version 1.3, only in code:
Line 870-872: make a comment in Line 871

Code: Select all

			If EventType() = #PB_EventType_LeftDoubleClick
				; \Event = #TabBarGadgetEvent_NewTab ; now double click for new tab is disabled
			EndIf
or you can check in your code, if you get the #TabBarGadgetEvent_NewTab -Event from the TabBarGadget check:
If EventType() <> #PB_EventType_LeftDoubleClick
_________

In the update 1.4, it will be set via \EnableDoubleClickForNewTab = #True/#Flase
I checked to code just after asking and saw it, sorry to have asked something so basic. Pretty easy to read by the way :D
sec
Enthusiast
Enthusiast
Posts: 789
Joined: Sat Aug 09, 2003 3:13 am
Location: 90-61-92 // EU or ASIA
Contact:

Re: TabBarGadget - Tabs like in a browser

Post by sec »

Hi STARGÅTE,
Please look my code is using TabBarGadget, but when i run below code and switch tab, then i can't touch/move/clickable into remote window.
Any idea?

Thanks

Code: Select all

XIncludeFile "C:\test\COMatePLUS\comateplus.pbi"
XIncludeFile "C:\test\TabBarGadget\TabBarGadget.pbi"
Procedure tab_remote()
  Define Server.s = "192.168.0.10"
  Global.COMateObject RdpObject

  RdpObject = Comate_CreateActiveXControl(0, 30+25, WindowWidth(0), WindowHeight(0) - 65, "mstscax.mstscax")
  
  If RdpObject
    RdpObject\SetProperty("Server = '" +Server + "'")
    RdpObject\SetProperty("AdvanceSettings3\Fullscreen = #True")
    RdpObject\SetProperty("AdvanceSettings3\SmartSizing = #True")
    RdpObject\Invoke("Connect()")
  EndIf
  
EndProcedure


OpenWindow(0, 0, 0, 800, 700, "2013", #PB_Window_MaximizeGadget|#PB_Window_Maximize|#PB_Window_MinimizeGadget)   
SmartWindowRefresh(0, #True)

tab_remote()

ListIconGadget(1, 0, 30+25, WindowWidth(0), WindowHeight(0), "IP", 240, #PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect | #PB_ListIcon_AlwaysShowSelection | #PB_ListIcon_MultiSelect)
AddGadgetColumn(1,1, "IP", 150)
AddGadgetColumn(1,2, "State", 400)

TabBarGadget(10, 0, 30, WindowWidth(0), 25, #TabBarGadget_NoTabMoving|#TabBarGadget_BottomLine)
AddTabBarGadgetItem(10, #PB_Default, "Main")
AddTabBarGadgetItem(10, #PB_Default, "Server1")
AddTabBarGadgetItem(10, #PB_Default, "Server2")
SetTabBarGadgetState(10, 1)


HideGadget(1, 1)

SetGadgetColor(1,   #PB_Gadget_LineColor , $000000)
Repeat
  event = WaitWindowEvent()
  Select event
    Case #PB_Event_CloseWindow 
      Break
    Case #PB_Event_Gadget
      Select EventGadget()
        Case 10 ;-tab
          Select TabBarGadgetEvent(10)
              
            Case #TabBarGadgetEvent_Change
              Debug "TabBarGadgetEvent: ChangeState"
              Debug "  Position: "+Str(EventTab(10))
              Debug "  Text: "+GetTabBarGadgetItemText(10, EventTab(10))
              
              
          EndSelect
      EndSelect
  EndSelect
ForEver
User avatar
STARGÅTE
Addict
Addict
Posts: 2084
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: TabBarGadget - Tabs like in a browser

Post by STARGÅTE »

Sorry, I can't reproduce the problem, the code works here, but i have no "Server.s = "192.168.0.10""
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8433
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: TabBarGadget - Tabs like in a browser

Post by netmaestro »

SmartWindowRefresh is code that limits screen drawing during resizes of the window, its purpose being to reduce flicker. Your window isn't resizable so there is no need to use that command in your code. If you're having problems with responsiveness at all, that's the first thing to get rid of. Granted, it probably won't solve it but you never know.
BERESHEIT
sec
Enthusiast
Enthusiast
Posts: 789
Joined: Sat Aug 09, 2003 3:13 am
Location: 90-61-92 // EU or ASIA
Contact:

Re: TabBarGadget - Tabs like in a browser

Post by sec »

@STARGÅTE: Could you try remote to virtual machine (using virtualbox)? or i will setup remote machine for you?
netmaestro wrote:SmartWindowRefresh is code that limits screen drawing during resizes of the window, its purpose being to reduce flicker. Your window isn't resizable so there is no need to use that command in your code. If you're having problems with responsiveness at all, that's the first thing to get rid of. Granted, it probably won't solve it but you never know.
I tried to get rid of SmartWindowRefresh() but the problem won't solve :(

Thanks much
sec
Enthusiast
Enthusiast
Posts: 789
Joined: Sat Aug 09, 2003 3:13 am
Location: 90-61-92 // EU or ASIA
Contact:

Re: TabBarGadget - Tabs like in a browser

Post by sec »

sec wrote:@STARGÅTE: Could you try remote to virtual machine (using virtualbox)? or i will setup remote machine for you?
netmaestro wrote:SmartWindowRefresh is code that limits screen drawing during resizes of the window, its purpose being to reduce flicker. Your window isn't resizable so there is no need to use that command in your code. If you're having problems with responsiveness at all, that's the first thing to get rid of. Granted, it probably won't solve it but you never know.
I tried to get rid of SmartWindowRefresh() but the problem won't solve :(

Thanks much
I found the problem.

Thanks you.
User avatar
kenmo
Addict
Addict
Posts: 1967
Joined: Tue Dec 23, 2003 3:54 am

Re: TabBarGadget - Tabs like in a browser

Post by kenmo »

Stargate, I want to thank you once again for the TabBarGadget, it works so well and is very simple to use!

Is it free to use in any software? Would you like me to credit you by name/website?

PS. I have made two modifications of my own: disabling the middle-click close action (maybe that could be an attribute?) and TabBarGadgetEvent() now reports right-clicks on tabs (to be handled by the main program).
c4s
Addict
Addict
Posts: 1981
Joined: Thu Nov 01, 2007 5:37 pm
Location: Germany

Re: TabBarGadget - Tabs like in a browser

Post by c4s »

@kenmo
Although I'm not STARGÅTE, I'll try to answer this. ;)
You can use it commercially in whatever way you want. The only restriction is that you have to include a link (source: http://www.unionbytes.de/help/tabbargad ... iches.html).
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
User avatar
kenmo
Addict
Addict
Posts: 1967
Joined: Tue Dec 23, 2003 3:54 am

Re: TabBarGadget - Tabs like in a browser

Post by kenmo »

Thanks for pointing that out. I did look on the webpage, but I did not look inside the help pages!
User avatar
Josh
Addict
Addict
Posts: 1183
Joined: Sat Feb 13, 2010 3:45 pm

Re: TabBarGadget - Tabs like in a browser

Post by Josh »

Hi Stargate,

would be nice, if after closing the active tab, the before used tab would be active again.

For example. I have 5 tabs and working on Tab 3. Now I open a new tab, testing a snipped and close this tab again. In this case, the new active tab should be Tab 3 and not Tab 5.

Thxs
Josh
sorry for my bad english
User avatar
STARGÅTE
Addict
Addict
Posts: 2084
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: TabBarGadget - Tabs like in a browser

Post by STARGÅTE »

That's a good idea. I will include it. My new version (with vertical tabs, editable tabs and improved scrolling) will published in 2 weeks. In the German forum is the beta version published.
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
User avatar
STARGÅTE
Addict
Addict
Posts: 2084
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: TabBarGadget - Tabs like in a browser

Post by STARGÅTE »

After a long break, it is time for a new update.

The new update brings a few changes and code changes! But the use of the include (even for new users) simplifies considerably.

Update 1.5 Beta 1 (19. October 2013)
  • Conversion of event management to PB 5.20 and BindEvent().
    TabBarGadgetEvent() is not necessary, event types
    can be queried with EventType().
  • When you create the gadget, window parameter is important.
  • Some constant names have been changed to be similar PureBasic.
  • EventTab(​​) I've removed to avoid name collision,
    it is now GetTabBarGadgetItemPosition() and SetTabBarGadgetItemPosition()
    so tabs can be moved with a command.
  • In addition, the functionality of vertical tabs, multi-select, checkboxes and the navigation has been improved.
  • The auto scroll does only work if threadsafe is enabled (for security)
Checkboxes example:
Image

Download: TabBarGadget V 1.5 Beta 1 Contains the include and the german help with explanations and example code
Online help with google translator: TabBarGadget Help
(But examples were broken!)

Would be nice if you test the new version.
In the help there is a small editor, where you can test in real-time all attributes:
http://www.unionbytes.de/help/tabbargad ... ditor.html

PS: I'm looking for someone who would translate the help into English (without google translator), please contact via PM.
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8433
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: TabBarGadget - Tabs like in a browser

Post by netmaestro »

Thanks for this! It's a lot of work and a very useful control indeed. Your sharing it with the community is much appreciated :D
BERESHEIT
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: TabBarGadget - Tabs like in a browser

Post by davido »

@STARGÅTE

Brilliant piece of work. Thanks for sharing. :D

I did, however, notice a small problem with the editor: When entering text the cursor repositions to the beginning after each keypress. It is not so bad with new entry as it can simply be entered backwards! :)
DE AA EB
Post Reply