I've encountered a problem with a button gadget.
I tried to have an button with size 12x12 pixel and a font size of 6.
The layout is: button and string gadget in first row, then an editor
gadget.
Everything looks fine, but the button and the string gadget do
always have a minimum size of 24 pixel.
How can I get button/string with less than 24 pixel?
Example code:
Code: Select all
EnableExplicit
Runtime Enumeration
#MainWindow
EndEnumeration
Runtime Enumeration
#Button1
#Text1
#Editor1
EndEnumeration
Define XML$
Define xmlGUI.i
Define dlgGUI.i
Procedure myResize()
Protected Text.s
Text+
"Button x: "+#TAB$+GadgetX(#Button1)+#CRLF$+
"Button y: "+#TAB$+GadgetY(#Button1)+#CRLF$+
"Button w: "+#TAB$+GadgetWidth(#Button1)+#CRLF$+
"Button h: "+#TAB$+GadgetHeight(#Button1)+#CRLF$+
"String x: "+#TAB$+GadgetX(#Text1)+#CRLF$+
"String y: "+#TAB$+GadgetY(#Text1)+#CRLF$+
"String w: "+#TAB$+GadgetWidth(#Text1)+#CRLF$+
"String h: "+#TAB$+GadgetHeight(#Text1)+#CRLF$+
"Window w: "+#TAB$+WindowWidth(#MainWindow, #PB_Window_InnerCoordinate)+#CRLF$+
"Window h: "+#TAB$+WindowHeight(#MainWindow, #PB_Window_InnerCoordinate)+#CRLF$
SetGadgetText(#Editor1, Text)
EndProcedure
XML$="<?xml version='1.0' encoding='UTF-8'?>"+
"<dialogs>"+
" <window ID='#MainWindow' text='Test' name='myWindow'"+
" minwidth='640' minheight='480'"+
" flags='#PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_ScreenCentered |"+
" #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget'>"+
" <vbox expand='item:2'>"+
" <hbox expand='item:2'>"+
" <button ID='#Button1' width='12' height='12' text='?'>"+
" </button>"+
" <string ID='#Text1' height='12' text='Text 1'>"+
" </string>"+
" </hbox>"+
" <!-- "+
" Dieser Bereich ist auskommentiert"+
" -->"+
" <editor ID='#Editor1' text='Editor 1'>"+
" </editor>"+
" </vbox>"+
" </window>"+
"</dialogs>"
LoadFont(1, "Arial", 6)
SetGadgetFont(#PB_Default, FontID(1))
xmlGUI = ParseXML(#PB_Any, XML$)
If xmlGUI
If XMLStatus(xmlGUI) = #PB_XML_Success
dlgGUI = CreateDialog(#PB_Any)
If dlgGUI
If OpenXMLDialog(dlgGUI, xmlGUI, "myWindow")
; SetGadgetFont(#Button1, FontID(1))
; SetGadgetFont(#Text1, FontID(1))
; SetGadgetFont(#Editor1, FontID(1))
myResize()
BindEvent(#PB_Event_SizeWindow, @myResize())
Repeat
Until WaitWindowEvent()=#PB_Event_CloseWindow
Else
Debug "Fehler in der Dialog-Definition: " + DialogError(dlgGUI)
EndIf
Else
Debug "Dialog konnte nicht erstellt werden!"
EndIf
Else
Debug "XML Fehler: " + XMLError(xmlGUI)
Debug " in Zeile " + Str(XMLErrorLine(xmlGUI)) + " an Position " + Str(XMLErrorPosition(xmlGUI))
EndIf
FreeXML(xmlGUI)
Else
Debug "XML$ konnte gelesen werden."
End
EndIf