Button size and position on OSX

BlitzMax Forums/MaxGUI Module/Button size and position on OSX

JoshK(Posted 2012) [#1]
Buttons in MaxGUI on OSX do not get created with their specified positions and dimensions. Is there some funny rule on OSX I am unaware of? You can clearly see these buttons are not the same width, though they are created with the same width:
' createwindow.bmx

Import MaxGui.Drivers

Strict 

AppTitle = "CreateWindow() Example"

Global FLAGS:Int

' Comment/uncomment any of the following lines to experiment with the different styles.

FLAGS:| WINDOW_TITLEBAR
FLAGS:| WINDOW_RESIZABLE
FLAGS:| WINDOW_MENU
FLAGS:| WINDOW_STATUS
FLAGS:| WINDOW_CLIENTCOORDS
'FLAGS:| WINDOW_HIDDEN
FLAGS:| WINDOW_ACCEPTFILES
'FLAGS:| WINDOW_TOOL
'FLAGS:| WINDOW_CENTER

Local window:TGadget = CreateWindow( AppTitle, 100, 100, 320, 240, Null, FLAGS )

If (FLAGS & WINDOW_STATUS) Then
	SetStatusText( window, "Left aligned~tCenter aligned~tRight aligned" )
EndIf

CreateButton "HELLO",10,10,80,30,window
CreateButton "BYE",10,40,80,60,window

Repeat
	WaitEvent()
	Print CurrentEvent.ToString()
	Select EventID()
		Case EVENT_APPTERMINATE, EVENT_WINDOWCLOSE
			End
	End Select
Forever



JoshK(Posted 2012) [#2]
I made a hack to force the square corner bezier which is more accurate.


DrDeath(Posted 2012) [#3]
The problem is that MaxGUI does not actually uses the same button type for both buttons: the upper one is a normal "push button", the lower one is a "bevel button" – which use different system resources and have different measurements.

You can try this yourself: open the Interface Builder coming with XCode, create a push button and a bevel button and scale them to the same size in the Inspector window using the W and H number boxes after selecting the "Frame" option in the pop-up menu above the boxes..