Page 1 of 1

Re: Multiple questions about new Dialog feature

Posted: Tue Sep 01, 2015 7:56 pm
by Shardik
Fred in announcement of PB 5.40 Beta 1 wrote:- Added "group" XML attribute for 'option' dialog gadget, to specify explicitly a group
Now with the new 'group' attribute for the 'option' dialog Kukulkan's code example from his first posting (or Fred's modified example) is working fine cross-platform (tested with PB 5.40 Beta 1 on Windows XP SP3, Kubuntu 14.04 x86 and MacOS X Yosemite x86):

Code: Select all

CompilerIf #PB_Compiler_Unicode
  #XmlEncoding = #PB_UTF8
CompilerElse
  #XmlEncoding = #PB_Ascii
CompilerEndIf

#Dialog = 0
#Xml = 0

XML$ = "<?xml version='1.0' ?>"+
       " <window id='#PB_Any' name='test' text='Gridbox' minwidth='auto' minheight='auto' flags='#PB_Window_ScreenCentered | #PB_Window_SystemMenu | #PB_Window_SizeGadget'>"+
       "   <gridbox columns='2'>"+
       "     <option group='1' name='cboProxy1' colspan='2' text='Keinen Proxy verwenden'/>"+
       "     <option group='1' name='cboProxy2' colspan='2' text='Proxy Server verwenden (server:port):'/>"+
       "     <empty /><string name='strProxyURL' minwidth='450' />"+
       "     <option group='1' name='cboProxy3' colspan='2' text='Proxy Autoconfiguration File (PAC) verwenden:'/>"+
       "     <empty /><string name='strProxyPACURL' minwidth='450' />"+
       "     <empty /><hbox>"+
       "                 <button name='btnOK' text='OK' />"+
       "                 <button name='btnCancel' text='Abbruch'/>"+
       "              </hbox>"+
       "   </gridbox>"+
       " </window>"

If CatchXML(#Xml, @XML$, StringByteLength(XML$), 0, #XmlEncoding) And XMLStatus(#Xml) = #PB_XML_Success
 
  If CreateDialog(#Dialog) And OpenXMLDialog(#Dialog, #Xml, "test")
    SetGadgetState(DialogGadget(0, "cboProxy1"), #True)

    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
Thank you PB team!

Re: Multiple questions about new Dialog feature

Posted: Wed Sep 02, 2015 7:27 am
by Kukulkan
Yes, this is nice and it was absolutely needed and necessary. Only pity that it took almost two years...

Re: Multiple questions about new Dialog feature

Posted: Wed Sep 02, 2015 5:04 pm
by blueb
Kukulkan wrote:Yes, this is nice and it was absolutely needed and necessary. Only pity that it took almost two years...
"Patience is bitter; but the fruit is sweet" :mrgreen: