Getting a dialog to have spacing='0'

Just starting out? Need help? Post your questions and find answers here.
es_91
Enthusiast
Enthusiast
Posts: 298
Joined: Thu Jan 27, 2011 12:00 pm
Location: DE

Getting a dialog to have spacing='0'

Post by es_91 »

Try this window with a container that shall have spacing='0' but has spacing='5' (default) instead.

Code: Select all

; Trying to fill the window with this gray container, but spacing shall be 0.


define  *xml
define  *dialog

define  xmlScript$


xmlScript$  =  "<window  id='#pb_any'  name=''  x='0'  y='0'  width='320'  height='200'  text='fill-out container?'  flags='#PB_Window_SizeGadget|#PB_Window_MaximizeGadget|#PB_Window_MinimizeGadget'>"  +  
               "<hbox spacing='0' expand='yes'>"  +  
               "<vbox spacing='0' expand='yes'>"  +  
               "<container spacing='0' id='#pb_any' name='cont' />"  +  
               "</vbox>"  +  
               "</hbox>"  +  
               "</window>"


*xml  =  catchXml  (  #pb_any,  
                      @  xmlScript$,  
                      stringByteLength  (  xmlScript$  )  )


*dialog  =  createDialog  (  #pb_any  )


if  (  (  *xml  )  and  
       (  isXml  (  *xml  )  )  and  
       (  xmlStatus  (  *xml  )  =  #pb_xml_success  )  and  
       (  *dialog  )  and  
       (  isDialog  (  *dialog  )  )  and  
       (  openXmlDialog  (  *dialog,  
                            *xml,  
                            "",  
                            #pb_ignore,  
                            #pb_ignore  )  )  )
	
	
	setGadgetColor  (  dialogGadget  (  *dialog,  
	                                    "cont"  ),  
	                   #pb_gadget_backColor,  
	                   rGB  (  191,  
	                           191,  
	                           191  )  )

	repeat
		if  (  waitWindowEvent  (  )  =  #pb_event_closeWindow  )
			end
		endIf
	forEver

endIf

; es_91 - 2025
What to do? Something wrong? :o
:mrgreen:
wombats
Enthusiast
Enthusiast
Posts: 716
Joined: Thu Dec 29, 2011 5:03 pm

Re: Getting a dialog to have spacing='0'

Post by wombats »

Use a <singlebox> with a negative margin. I haven't tested this, so I'm not sure if -5 is enough.

Code: Select all

<singlebox margin='-5'> ... </singlebox>
es_91
Enthusiast
Enthusiast
Posts: 298
Joined: Thu Jan 27, 2011 12:00 pm
Location: DE

Re: Getting a dialog to have spacing='0'

Post by es_91 »

Yep! It works. :mrgreen:

For some reason '-8' is the exact value needed (at my system).

Code: Select all

xmlScript$  =  "<window  id='#pb_any'  name=''  x='0'  y='0'  width='320'  height='200'  text='fill-out container?'  flags='#PB_Window_SizeGadget|#PB_Window_MaximizeGadget|#PB_Window_MinimizeGadget'>"  +  
               "<singlebox expand='yes' margin='-8'>"  +  
               "<container id='#pb_any' name='cont' />"  +  
               "</singlebox>"  +  
               "</window>"
Thank you! 8)
:mrgreen:
User avatar
HeX0R
Addict
Addict
Posts: 1187
Joined: Mon Sep 20, 2004 7:12 am
Location: Hell

Re: Getting a dialog to have spacing='0'

Post by HeX0R »

Margin=0 for the window should be enough

Code: Select all

xmlScript$ = "<window width='320' height='200' text='fill-out container?' flags='#PB_Window_SizeGadget|#PB_Window_MaximizeGadget|#PB_Window_MinimizeGadget' margin='0'><hbox spacing='0' expand='yes'><vbox spacing='0' expand='yes'><container spacing='0' id='#pb_any' name='cont' /></vbox></hbox></window>"
*xml=CatchXML(#PB_Any,@xmlScript$,StringByteLength(xmlScript$)):*dialog=CreateDialog(#PB_Any)
If(*xml And(IsXML(*xml))And(XMLStatus(*xml)=#PB_XML_Success)And(*dialog)And(IsDialog(*dialog))And(OpenXMLDialog(*dialog,*xml,"",#PB_Ignore,#PB_Ignore)))
SetGadgetColor(DialogGadget(*dialog,"cont" ),#PB_Gadget_BackColor,RGB(191,191,191)):Repeat:If(WaitWindowEvent()=#PB_Event_CloseWindow):End:EndIf:ForEver:EndIf

(©Inverse coding-style of es_91)
es_91
Enthusiast
Enthusiast
Posts: 298
Joined: Thu Jan 27, 2011 12:00 pm
Location: DE

Re: Getting a dialog to have spacing='0'

Post by es_91 »

@HeXOR:

Nice! 8)

I never knew the window would have an 8 px margin, it's propably because of the 8 px thick borders introduced with Windows 8.

Here your code in Fred's style:

Code: Select all

xmlScript$  +  "<window width='320' height='200' text='fill-out container!' flags='#PB_Window_SizeGadget|#PB_Window_MaximizeGadget|#PB_Window_MinimizeGadget' margin='0'>" + 
               "<hbox spacing='0' expand='yes'>" + 
               "<vbox spacing='0' expand='yes'>" + 
               "<container spacing='0' id='#pb_any' name='cont' />"  + 
               "</vbox>" + 
               "</hbox>" + 
               "</window>"

*xml = CatchXML (#PB_Any, @xmlScript$, StringByteLength (xmlScript$))

*dialog = CreateDialog (#PB_Any)

If *xml And IsXML (*xml) And XMLStatus (*xml) = #PB_XML_Success And *dialog And IsDialog (*dialog) And OpenXMLDialog (*dialog, *xml, "", #PB_Ignore, #PB_Ignore)

	SetGadgetColor (DialogGadget (*dialog, "cont"), #PB_Gadget_BackColor, RGB (127, 127, 127))
	
	Repeat
		
		If WaitWindowEvent () = #PB_Event_CloseWindow
			
			End
			
		EndIf
		
	ForEver
	
EndIf
:mrgreen:
Post Reply