Page 6 of 13

Re: TabBarGadget - Tabs like in a browser

Posted: Wed Feb 12, 2014 3:47 am
by kenmo
Stargate, yes your test code works OK for me. But guess what, I found and fixed the Mac problem -- and it only involves swapping two lines of code :shock:

Inside your PostUpdate() function, simply change

Code: Select all

PostEvent(#PB_Event_Gadget, *TabBarGadget\Window, *TabBarGadget\Number, #TabBarGadget_EventType_Updated, -1)
*TabBarGadget\UpdatePosted = #True
to

Code: Select all

*TabBarGadget\UpdatePosted = #True
PostEvent(#PB_Event_Gadget, *TabBarGadget\Window, *TabBarGadget\Number, #TabBarGadget_EventType_Updated, -1)
I think PostEvent() + BindEvent() behave differently on Mac and PC. On Mac, your Callback is called IMMEDIATELY upon PostEvent(). I have verified this by placing Debug statements where UpdatePosted is set #True and where it is set #False, then ran it and checked the order they appear.

So the problem was:
1. I call SetTabBarGadgetItemImage() on the first tab...
2. The ImageID is changed...
3. PostEvent() with #TabBarGadget_EventType_Updated...
4. The Callback() function IMMEDIATELY redraws the TabBar, and sets UpdatePosted #False...
5. THEN UpdatePosted is set to #True...
6. Now I call SetTabBarGadgetItemImage() on the second tab...
7. The ImageID is changed...
8. Since UpdatePosted is set to #True, no event is posted, no callback is executed, the TabBar is not redrawn!!!
9. Moving the mouse over the TabBar causes it to redraw the new icon correctly

To fix it, swap those two lines. Now UpdatePosted is set #True before the Callback runs. I hope this all makes sense! :)

Re: TabBarGadget - Tabs like in a browser

Posted: Wed Feb 12, 2014 9:47 am
by deeproot
STARGÅTE wrote:Please test this code on Mac, with this PostEvent/BindEvent combination:
Also works OK for me - OSX 10.6.8, Xcode 3.2.6

Interesting report from kenmo. My project does not do the same things, so I didn't see any other problem. Though I only use TabBarGadet 1.5b1 in a simple way, everything I need is working fine on Mac and Windows. Also just starting with Linux and looks good so far.

Re: TabBarGadget - Tabs like in a browser

Posted: Wed Feb 12, 2014 6:51 pm
by kenmo
Hi deeproot. I have only tested on two Macs (OSX 10.5 and 10.8 I think) but I saw the same problem on both.

Did you test my 2-tab example, and did you make sure to click both ButtonGadgets without clicking or even hovering over the TabBarGadget in between? For me, I see the first tab change icon; the second icon will not redraw until I interact with it.

Just to clarify, the TabBarGadget looks fine and works fine otherwise. Haven't tried it on Linux!

Re: TabBarGadget - Tabs like in a browser

Posted: Wed Feb 12, 2014 9:06 pm
by deeproot
@kenmo

I just tried your example and yes - I get the same effect you described. Well spotted!

As mentioned, it didn't show up in my project. The initialisation of my main window is quite involved and always calls UpdateTabBarGadget - I think that fixes the first display (pure coincidence!). Then I don't need to replace the tab images (so far).

I agree it's great work by Stargåte - well worth sorting any glitches.

Re: TabBarGadget - Tabs like in a browser

Posted: Thu Feb 13, 2014 4:51 am
by Fangbeast
StarGate, there are no example codes in the archive when expanded?

Re: TabBarGadget - Tabs like in a browser

Posted: Thu Feb 13, 2014 10:57 am
by STARGÅTE
Examples are in the help file (in the archive) or in the online help:
http://www.unionbytes.de/help/tabbargad ... piele.html

Re: TabBarGadget - Tabs like in a browser

Posted: Thu Feb 13, 2014 11:48 am
by Fangbeast
STARGÅTE wrote:Examples are in the help file (in the archive) or in the online help:
http://www.unionbytes.de/help/tabbargad ... piele.html
I meant the examples that used to be provided with code and icons?

If it's all in the help, no worries then.

Re: TabBarGadget - Tabs like in a browser

Posted: Tue Feb 18, 2014 8:11 pm
by aaaaaaaargh
:shock: This is really awesome!

Thanks ever so much for sharing!

Re: TabBarGadget - Tabs like in a browser

Posted: Sun Mar 09, 2014 5:04 pm
by mestnyi
STARGÅTE And it is impossible to do so when the tabs do not fit (ie, when the locomotive) two buttons appear before the other one back and not left as Sach one another right?

Re: TabBarGadget - Tabs like in a browser

Posted: Sat Jul 05, 2014 11:45 pm
by staringfrog
STARGÅTE,

your lib looks so alluring, really. By the way, does TabBarGadget support bottom (vertically flipped) tabbars? Somehow I can't figure it out in your panzergemachtkaputt of a helpfile :D

P.S. Dankeschon for your quick reply.

Re: TabBarGadget - Tabs like in a browser

Posted: Sat Jul 05, 2014 11:49 pm
by STARGÅTE
Yes.
You can use #TabBarGadget_MirroredTabs (as flag) to flip the Tabs.

Re: TabBarGadget - Tabs like in a browser

Posted: Sat Jul 12, 2014 4:03 pm
by staringfrog
Dear Stargate,

from what I get from gTranslate and your examples, it's not quite clear how to apply the DefaultHeight constant:
Specify the position (X, Y) and the dimensions (width, height) of the tab bar. # TabBarGadget_DefaultHeight can be used for Height or Width to take advantage of automatic optimal height map.
Can it be reset (and where, as I found only one mention of it in .pbi) or applied to Width as well? Sort of nebulous description, especially in that optimum height part. Is it meant to be font-size dependent or what? Can you elucidate, please?

The other question is how to set specific attributes to a single tab item in a TabBar. Say, I want all tabs but the first one be fitted up with a CloseButton (which might be a regular situation with some common application tasks, I guess). The way I see it from your snippets, you can only combine two instances (two gadgets) of TabBar to achieve this, is it so?

Thank you in advance for your kind replies.

Re: TabBarGadget - Tabs like in a browser

Posted: Sat Jul 12, 2014 4:37 pm
by STARGÅTE
  1. If you use #TabBarGadget_DefaultHeight (not a real height value), the height of the tab bar will calculated automatically, depending on the font height of the operating system:

    Code: Select all

    XIncludeFile "TabBarGadget.pbi"
    
    OpenWindow(1, 0, 0, 800, 600, "WindowTitle", #PB_Window_MinimizeGadget|#PB_Window_ScreenCentered)
    TabBarGadget(1, 0, 0, 800, #TabBarGadget_DefaultHeight, #TabBarGadget_CloseButton, 1)
    	AddTabBarGadgetItem(1, -1, "Alpha")
    	AddTabBarGadgetItem(1, -1, "Beta")
    
    SetGadgetFont(#PB_Default, LoadFont(1, "Arial", 20))
    
    TabBarGadget(2, 0, 50, 800, #TabBarGadget_DefaultHeight, #TabBarGadget_CloseButton, 1)
    	AddTabBarGadgetItem(2, -1, "Alpha")
    	AddTabBarGadgetItem(2, -1, "Beta")
    
    Repeat
    Until WaitWindowEvent() = #PB_Event_CloseWindow
  2. Currently there is no way to change attributes of tabs individually.
    But this feature was wished from other members also.
    So I will try to implement this feature, like SetTabBarGadgetItemAttribute().
  3. "Is there any plan for an "officia" version 1.5 release?"
    I have add some new features (vertical tabs, multi-select, checkboxes, autoscroll) in this beta, but I haven't got feedback.
    I also know, that some of you need a good english documentation, so I am working on it.

Re: TabBarGadget - Tabs like in a browser

Posted: Sat Jul 12, 2014 7:08 pm
by staringfrog
Stargate, I hate to ask you again, and yet, do you ever plan to implement text alignment for tabs (in case of really wide, stretched ones), or do I miss something again (haven't found it in 1.5 b1 either)? Probably, it's not that easy, I realize it, given all those frills and images one can pin to tabs, besides text labels. Nonetheless, do you think it is possible to employ (things like) #PB_Text_Center (say, for tabs w/o images only) in your future versions?

Re: TabBarGadget - Tabs like in a browser

Posted: Sat Jul 12, 2014 7:37 pm
by STARGÅTE
Tabs have always the width of the text (+ image), so you can't align the text in the tab.
If you have set a minimal tab width, you get an empty space, yes.
For this case you need some like align: left, right, center?
I add it on my to do list, but I can not say when I have time to implement it (sry).

But thank you for using the gadget.