Just starting out? Need help? Post your questions and find answers here.
-
Mesa
- Enthusiast

- Posts: 433
- Joined: Fri Feb 24, 2012 10:19 am
Post
by Mesa »
See the differences between dialog (top) and no dialog (bottom).
Is there a solution ?
Code: Select all
#Dialog = 0
#Xml = 0
XML$ = ~"<dialogs>\n"
XML$ + ~" <window name='test' flags='#PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget'>\n"
XML$ + ~" <vbox spacing='0' expand='no'>\n"
XML$ + ~" <panel name='panel_1' height='100' margin='vertical:-5,horizontal:-5'>\n"
XML$ + ~" <tab text='Dialog=margins (panel and canvas)'>\n"
XML$ + ~" <canvas name='canvas_1' margin='left:-5,right:-5,bottom:-5,vertical:-5,horizontal:-5'/>\n"
XML$ + ~" </tab>\n"
XML$ + ~" </panel>\n"
XML$ + ~" </vbox>\n"
XML$ + ~" </window>\n"
XML$ + ~"</dialogs>\n"
XML$ + ~""
If ParseXML(#Xml, XML$) And XMLStatus(#Xml) = #PB_XML_Success
If CreateDialog(#Dialog) And OpenXMLDialog(#Dialog, #Xml, "test")
hwd=DialogWindow(#Dialog)
PanelGadget(0,0,150,600,100)
AddGadgetItem (0, -1, "No Dialog=No margins (panel and canvas)")
CanvasGadget(1,0,0,600,100)
CloseGadgetList()
ResizeWindow(hwd,#PB_Ignore,#PB_Ignore,600,400)
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
Else
Debug "Error : " + DialogError(#Dialog)
EndIf
Else
Debug "Error XML : " + XMLError(#Xml) + " (Line: " + XMLErrorLine(#Xml) + ")"
EndIf
M.
-
Cyllceaux
- Enthusiast

- Posts: 510
- Joined: Mon Jun 23, 2014 1:18 pm
Post
by Cyllceaux »
easy
It's not documented, but the window has a margin attribute, too.
-
Mesa
- Enthusiast

- Posts: 433
- Joined: Fri Feb 24, 2012 10:19 am
Post
by Mesa »
Thanks.
The solution is:
Code: Select all
#Dialog = 0
#Xml = 0
XML$ = ~"<dialogs>\n"
XML$ + ~" <window flags='#PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget' name='test'>\n"
XML$ + ~" <singlebox expand='horizontal' margin='vertical:-8,horizontal:-9'>\n"
XML$ + ~" <panel name='panel_1'>\n"
XML$ + ~" <tab>\n"
XML$ + ~" <singlebox expand='horizontal' margin='vertical:-9,horizontal:-10'>\n"
XML$ + ~" <canvas width='300' height='100' name='canvas_1'/> \n"
XML$ + ~" </singlebox>\n"
XML$ + ~" </tab>\n"
XML$ + ~" <tab/> \n"
XML$ + ~" </panel>\n"
XML$ + ~" </singlebox> \n"
XML$ + ~" </window>\n"
XML$ + ~"</dialogs>\n"
XML$ + ~""
If ParseXML(#Xml, XML$) And XMLStatus(#Xml) = #PB_XML_Success
If CreateDialog(#Dialog) And OpenXMLDialog(#Dialog, #Xml, "test")
hwd=DialogWindow(#Dialog)
PanelGadget(0,0,150,600,100)
AddGadgetItem (0, -1, "No Dialog=No margins (panel and canvas)")
CanvasGadget(1,0,0,600,100)
CloseGadgetList()
ResizeWindow(hwd,#PB_Ignore,#PB_Ignore,600,400)
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
Else
Debug "Error : " + DialogError(#Dialog)
EndIf
Else
Debug "Error XML : " + XMLError(#Xml) + " (Line: " + XMLErrorLine(#Xml) + ")"
EndIf
M.
-
RASHAD
- PureBasic Expert

- Posts: 4946
- Joined: Sun Apr 12, 2009 6:27 am
Post
by RASHAD »
Hi
No need for any extra object
Code: Select all
XML$ = ~"<dialogs>\n"
XML$ + ~" <window name='test' margin='left:0,top:10,right:10,bottom:10' flags='#PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget'>\n"
XML$ + ~" <vbox spacing='0' expand='no'>\n"
XML$ + ~" <panel name='panel_1' height='100' margin='vertical:-5,horizontal:-5'>\n"
XML$ + ~" <tab text='Dialog=margins (panel and canvas)'>\n"
XML$ + ~" <canvas name='canvas_1' margin='left:-5,right:-5,bottom:-5,vertical:-5,horizontal:-5'/>\n"
XML$ + ~" </tab>\n"
XML$ + ~" </panel>\n"
XML$ + ~" </vbox>\n"
XML$ + ~" </window>\n"
XML$ + ~"</dialogs>\n"
XML$ + ~""
Egypt my love
-
dige
- Addict

- Posts: 1391
- Joined: Wed Apr 30, 2003 8:15 am
- Location: Germany
-
Contact:
Post
by dige »
Cool, We can do a lot more with the Dialog Library, als only creating gadgets. Is there a website where these styles are described?
You can also use a dialog within an existing (Container)gadget?
Ciao Dige
"Daddy, I'll run faster, then it is not so far..."