I'm trying to get buttons on my dialog to have the #NSRoundedBezelStyle style, but I can't see how to set a fixed height of 25 when using automatic positioning with the new Dialog library. I know there is code for doing this with CocoaMessage(), but for some reason, that is causing crashes in my application (with ColorRequester()) that I've yet to pin down, and cannot reproduce. >_<
Shouldn't all buttons have this style by default anyway? :\
Button style, XML Dialog
Re: Button style, XML Dialog
That's possible.wombats wrote:Shouldn't all buttons have this style by default anyway? :\
You can only change the style after creating the dialog. HERE a code by gwhuntoon to change the style.
So with Dialogs it looks like this (disable UNICODE, doesn't work on OSX):
Code: Select all
CompilerIf #PB_Compiler_Unicode
#XmlEncoding = #PB_UTF8
CompilerElse
#XmlEncoding = #PB_Ascii
CompilerEndIf
#Dialog = 0
#Xml = 0
#NSRoundedBezelStyle = 1
#NSRegularSquareBezelStyle = 2
#NSThickSquareBezelStyle = 3
#NSThickerSquareBezelStyle = 4
#NSDisclosureBezelStyle = 5
#NSShadowlessSquareBezelStyle = 6
#NSCircularBezelStyle = 7
#NSTexturedSquareBezelStyle = 8
#NSHelpButtonBezelStyle = 9
#NSSmallSquareBezelStyle = 10
#NSTexturedRoundedBezelStyle = 11
#NSRoundRectBezelStyle = 12
#NSRecessedBezelStyle = 13
#NSRoundedDisclosureBezelStyle = 14
XML$ = "<?xml version='1.0'?>"+
"<dialogs>"+
" <window id='#Window_Main' name='Window_Main' text='app' width='455' height='200' flags='#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_SizeGadget|#PB_Window_ScreenCentered'>"+
" <gridbox columns='6'>" +
" <button text='Button 1' name='btn1' height='25' />" +
" <button text='Button 2' name='btn2' height='25' />" +
" <button text='Button 3' name='btn3' height='25' />" +
" <button text='Button 4' name='btn4' height='25' />" +
" <button text='' name='btn5' height='25' />" +
" <button text='Button 6' name='btn6' height='25' />" +
" <button text='' name='btn7' height='25' />" +
" <button text='Button 8' name='btn8' height='25' />" +
" <button text='' name='btn9' height='25' />" +
" <button text='Button 10' name='btn10' height='25' />" +
" <button text='Button 11' name='btn11' height='25' />" +
" <button text='Button 12' name='btn12' height='25' />" +
" <button text='Button 13' name='btn13' height='25' />" +
" <button text='' name='btn14' height='25' />" +
" </gridbox>" +
" </window>"+
"</dialogs>"
If CatchXML(#Xml, @XML$, StringByteLength(XML$), 0, #XmlEncoding) And XMLStatus(#Xml) = #PB_XML_Success
If CreateDialog(#Dialog) And OpenXMLDialog(#Dialog, #Xml, "Window_Main")
For i = 1 To 14
CocoaMessage(0, GadgetID(DialogGadget(#Dialog, "btn"+Str(i))), "setBezelStyle:", i)
Next
;SetActiveGadget( DialogGadget(#Dialog,"btn1") )
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
Else
Debug "Dialog error: " + DialogError(#Dialog)
EndIf
Else
Debug "XML error: " + XMLError(#Xml) + " (Line: " + XMLErrorLine(#Xml) + ")"
EndIf
