MaxGUI Users: Am I OK to proceed?

BlitzMax Forums/MaxGUI Module/MaxGUI Users: Am I OK to proceed?

SebHoll(Posted 2009) [#1]
Hi Peeps,

There is quite a big discrepancey in how toolbars affect a window's client area across the MaxGUI drivers, but in order to do something about it may mean that a few gadget positions have to re-set to account for the elimination of the y-offset. Let me explain...

On Windows, when a toolbar is added to a window, the toolbar is simply positioned at the top-left corner of the client area pretty much like any other gadget. This means that if you want to add a gadget to your window, you have to effectively add an offset of the toolbar height to all your gadgets. If you then draw gadgets at, say, (0,0), they will be lost/hidden/drawn-over the toolbar. This is quite easily worked around when realized, but it's a bit yucky as if the toolbar height changes you have to update the offset for all of your gadgets. Iirc, FLTKMaxGUI has this same behaviour.

However, on Mac OS X, the toolbar is part of the window frame, and so adding a toolbar pushes the client area of the window down. Gadgets created at (0,0) are added to the origin of the client area, and so will appear under the toolbar as expected.

Now there is an obvious discrepancy here in where gadgets will be positioned on each platform and I really think this should be normalized so that gadget positioning is the same across all platforms. People coding apps with toolbars will no doubt have had to use compiler directives to work around this up until now. To me, the Mac system is much cleaner, MaxGUI (as the application framework) is looking after everything for you, so if I was to normalize this behaviour, this would be the convention the other Windows and FLTK modules would adopt.

However, this will mean that when you Windows guys recompile your apps with the new MaxGUI, you will have take off this offset from any gadgets you have parented directly the client window.

So the question is, would you guys be OK with having to do this once when the new MaxGUI is released, or would you prefer I left it and you can work around the issue with compiler directives like has always been the case?

Place your votes!


_Skully(Posted 2009) [#2]
I think its a necessary evil... and really not that much work


SebHoll(Posted 2009) [#3]
Cool!

Edit: Actually, I just realized something that might throw a spanner in the works... It may be the case that in order to implement this behaviour cleanly, I have to "fix" the old problem where people were allowed to parent toolbars to panels. This has never been officially supported in MaxGUI and hence CocoaMaxGUI doesn't support it, but it just works on Windows by complete chance. This was more a problem when people wanted buttons with icons on them, but people can use SetGadgetPixmap() with standard push buttons now.

So in summary, I may have to "fix"/"break panels with toolbars on Windows so that it is inline with the other modules. I expect this is gonna make a lot of people unhappy, so maybe it's best to leave it.


Ked(Posted 2009) [#4]
I vote that when a toolbar is added, the client area should be pushed down.


TaskMaster(Posted 2009) [#5]
Yep, do it. Make it right.


Htbaa(Posted 2009) [#6]
I use Logic GUI anyway so I don't think it's a problem for me.


degac(Posted 2009) [#7]
I like the idea to 'push down' the client area when a toolbar is added, like in Cocoa.


SebHoll(Posted 2009) [#8]
Cheers guys! I will go ahead and fix this for the next MaxGUI release. I've made hiding/showing the toolbar also update the client area too so it will be super easy to have a "Hide Toolbar" button in your app. (Mac users still have their decidated toolbar pill provided by the window managed though, too.)

Anyone else have any thoughts on the matter? Leadwerks? Sswift?


jsp(Posted 2009) [#9]
A very good idea actually, i hate the current behavior, nevertheless it will generate quite some work;)


SebHoll(Posted 2009) [#10]
Cool... Well it's taken me pretty much an entire day as there are quite a few other bugs and discrepancies that this uncovered in each of the modules, but this should be the new behaviour in the next MaxGUI.


JoshK(Posted 2009) [#11]
Will the window client area adjust when the toolbar is hidden/shown?


SebHoll(Posted 2009) [#12]
Will the window client area adjust when the toolbar is hidden/shown?

The client-area and window will size itself appropriately whenever a toolbar is created, freed, hidden or shown meaning that, providing all the gadgets have been SetGadgetLayout()'d properly, they'll be positioned automatically. :-)


JoshK(Posted 2009) [#13]
Sounds good then.


SebHoll(Posted 2009) [#14]
Cool! :-)


Mark Tiffany(Posted 2009) [#15]
sounds good to me.