Dialog XML creation - Changes in processing with PB5.40?

Just starting out? Need help? Post your questions and find answers here.
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2158
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Dialog XML creation - Changes in processing with PB5.40?

Post by Andre »

Did anyone notice the same effect, that XML dialog definitions (and their related GUI created) worked with PB5.31 and don't work properly with PB5.40?

The following XML code is programmatically created by my application and displays well (with all gadgets and images inside the Scrollarea) when compiled with PB5.31. But it only shows the title and the scrollarea border (but not its content) when compiled with PB5.40.... :?

Or could it be my fault, and anyone sees an error in the XML definition?

Thanks for your help!

Code: Select all

<?xml version='1.0' encoding='ISO-8859-1' ?>
<window id='#PB_Any' minwidth='500' minheight='410' text='Informationen über die Welterbestätte: Zeche Zollverein und Kokerei Zollverein in Essen' flags='#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_SizeGadget|#PB_Window_WindowCentered'>
  <container name='WHContainer' flags='#PB_Container_Single'>
    <vbox align='center' spacing='0' expand='item:2'>
      <hbox align='left' spacing='3' expand='item:1'>
        <vbox align='left' spacing='2' expand='item:2'>
          <text name='WHNameTitle' text='Welterbestätte:' width='103' height='17'  />
          <hbox align='left' spacing='2' expand='item:3'>
            <empty/><empty/>
            <text name='WHName' text='Zeche Zollverein und Kokerei Zollverein in Essen' />
          </hbox>
          <text/>
        </vbox>
        <singlebox align='center' expand='no' margin='0'>
          <buttonimage name='WHListImage' width='22' height='22' />
        </singlebox>
      </hbox>
      <scrollarea flags='#PB_ScrollArea_Single'>
        <vbox align='left' spacing='0'>
          <text name='WHNameIntTitle' text='Internationaler Name:' width='136' height='17'  />
          <hbox align='left' spacing='2' expand='item:3'>
            <empty/><empty/>
            <text name='WHNameInt' text='Zollverein Coal Mine Industrial Complex in Essen' />
          </hbox>
          <text/>
          <text name='WHRegionTitle' text='Region:' width='59' height='17'  />
          <hbox align='left' spacing='3' expand='item:3'>
            <empty/><empty/>
            <text text='Europa & Nordamerika' />
          </hbox>
          <text/>
          <text name='WHTypeTitle' text='Typ:' width='41' height='17'  />
          <hbox align='left' spacing='3' expand='item:3'>
            <empty/><empty/>
            <text text='Kultur-Welterbestätte' />
          </hbox>
          <text/>
          <text name='WHStatusTitle' text='Status:' width='56' height='17'  />
          <hbox align='left' spacing='3' expand='item:3'>
            <empty/><empty/>
            <text text='2001 aufgenommen (25. Sitzung)' />
          </hbox>
          <text/>
          <text name='WHPosTitle' text='Lage' width='45' height='17'  />
          <hbox align='left' spacing='3' expand='item:4'>
            <empty/><empty/>
            <text text='Kontinent:' />
            <hyperlink name='WHContinent' text='Europa' flags='#PB_HyperLink_Underline' />
          </hbox>
          <hbox align='center' spacing='3' expand='no'>
            <empty/><empty/>
            <text text='Land:' />
            <hyperlink name='WHCountry1' text=' Deutschland ' flags='#PB_HyperLink_Underline' />
          </hbox>
          <text/>
          <text name='WHCoordinatesTitle' text='Geografische Koordinaten:' width='165' height='17'  />
          <hbox align='left' spacing='3' expand='item:3'>
            <empty/><empty/>
            <text text='51,49° Nord, 7,05° Ost' />
          </hbox>
          <text/>
          <hbox align='center' spacing='3' expand='item:3'>
            <empty/><empty/>
            <image name='WHMapImage' width='240' height='120' />
          </hbox>
          <text/>
          <text name='WHAddInfoTitle' text='Weitere Informationen:' width='145' height='17'  />
          <hbox align='left' spacing='3' expand='item:3'>
            <empty/><empty/>
            <hyperlink name='WHUnescoLink' text='Link zur UNESCO-Welterbe-Seite' flags='#PB_HyperLink_Underline' />
            <image name='WHLogoImage' width='29' height='30' />
            <text text='(ID 975)' />
          </hbox>
          <text/>
        </vbox>
      </scrollarea>
    </vbox>
  </container>
</window>
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
Oma
Enthusiast
Enthusiast
Posts: 312
Joined: Thu Jun 26, 2014 9:17 am
Location: Germany

Re: Dialog XML creation - Changes in processing with PB5.40?

Post by Oma »

Hello Andre,

on Linux Xubuntu 14.04/32:
I added a 'name= ' to <window id= to work with my routines ???,
but:
on PB5.31 it works

on PB5.40
gtk3: it works, but the gadget distances are huge,
gtk2: no slider is shown and only the following lines are shown:
Internationaler Name:
Zollverein Coal Mine Industrial Complex in Essen
Region:
Europa & Nordamerika
with huge distances, the Rest is missing.

Regards,
Charly
PureBasic 5.4-5.7, Linux: (X/L/K)Ubuntus+Mint - Windows XP (32Bit)
PureBasic Linux-API-Library & Viewer: http://www.chabba.de
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2158
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Re: Dialog XML creation - Changes in processing with PB5.40?

Post by Andre »

@Oma : Thank you for testing! As you also got different results, it should have something to do with different GUI creation on different systems. So the 'problem' is probably more related to the gadget creation than to the XML definition...!?

Beside that I don't think, that a name for the window is neccessary (instead / beside of using #PB_Any), as the window itself is correctly created everywhere...

Anyone more with Dialog experiences for testing? Thank you!
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2158
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Re: Dialog XML creation - Changes in processing with PB5.40?

Post by Andre »

To make testing easier and in the hope for more test results / responds with suggestions etc. I embedded the XML definition in test code, which could be compiled/run...

Code: Select all

XML$ +
"<?xml version='1.0' encoding='ISO-8859-1' ?>" +
"<window name='test' id='#PB_Any' minwidth='500' minheight='410' text='Informationen über die Welterbestätte: Zeche Zollverein und Kokerei Zollverein in Essen' flags='#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_SizeGadget|#PB_Window_WindowCentered'>" +
"  <container name='WHContainer' flags='#PB_Container_Single'>" +
"    <vbox align='center' spacing='0' expand='item:2'>" +
"      <hbox align='left' spacing='3' expand='item:1'>" +
"        <vbox align='left' spacing='2' expand='item:2'>" +
"          <text name='WHNameTitle' text='Welterbestätte:' width='103' height='17'  />" +
"          <hbox align='left' spacing='2' expand='item:3'>" +
"            <empty/><empty/>" +
"            <text name='WHName' text='Zeche Zollverein und Kokerei Zollverein in Essen' />" +
"          </hbox>" +
"          <text/>" +
"        </vbox>" +
"        <singlebox align='center' expand='no' margin='0'>" +
"          <buttonimage name='WHListImage' width='22' height='22' />" +
"        </singlebox>" +
"      </hbox>" +
"      <scrollarea flags='#PB_ScrollArea_Single'>" +
"        <vbox align='left' spacing='0'>" +
"          <text name='WHNameIntTitle' text='Internationaler Name:' width='136' height='17'  />" +
"          <hbox align='left' spacing='2' expand='item:3'>" +
"            <empty/><empty/>" +
"            <text name='WHNameInt' text='Zollverein Coal Mine Industrial Complex in Essen' />" +
"          </hbox>" +
"          <text/>" +
"          <text name='WHRegionTitle' text='Region:' width='59' height='17'  />" +
"          <hbox align='left' spacing='3' expand='item:3'>" +
"            <empty/><empty/>" +
"            <text text='Europa & Nordamerika' />" +
"          </hbox>" +
"          <text/>" +
"          <text name='WHTypeTitle' text='Typ:' width='41' height='17'  />" +
"          <hbox align='left' spacing='3' expand='item:3'>" +
"            <empty/><empty/>" +
"            <text text='Kultur-Welterbestätte' />" +
"          </hbox>" +
"          <text/>" +
"          <text name='WHStatusTitle' text='Status:' width='56' height='17'  />" +
"          <hbox align='left' spacing='3' expand='item:3'>" +
"            <empty/><empty/>" +
"            <text text='2001 aufgenommen (25. Sitzung)' />" +
"          </hbox>" +
"          <text/>" +
"          <text name='WHPosTitle' text='Lage' width='45' height='17'  />" +
"          <hbox align='left' spacing='3' expand='item:4'>" +
"            <empty/><empty/>" +
"            <text text='Kontinent:' />" +
"            <hyperlink name='WHContinent' text='Europa' flags='#PB_HyperLink_Underline' />" +
"          </hbox>" +
"          <hbox align='center' spacing='3' expand='no'>" +
"            <empty/><empty/>" +
"            <text text='Land:' />" +
"            <hyperlink name='WHCountry1' text=' Deutschland ' flags='#PB_HyperLink_Underline' />" +
"          </hbox>" +
"          <text/>" +
"          <text name='WHCoordinatesTitle' text='Geografische Koordinaten:' width='165' height='17'  />" +
"          <hbox align='left' spacing='3' expand='item:3'>" +
"            <empty/><empty/>" +
"            <text text='51,49° Nord, 7,05° Ost' />" +
"          </hbox>" +
"          <text/>" +
"          <hbox align='center' spacing='3' expand='item:3'>" +
"            <empty/><empty/>" +
"            <image name='WHMapImage' width='240' height='120' />" +
"          </hbox>" +
"          <text/>" +
"          <text name='WHAddInfoTitle' text='Weitere Informationen:' width='145' height='17'  />" +
"          <hbox align='left' spacing='3' expand='item:3'>" +
"            <empty/><empty/>" +
"            <hyperlink name='WHUnescoLink' text='Link zur UNESCO-Welterbe-Seite' flags='#PB_HyperLink_Underline' />" +
"            <image name='WHLogoImage' width='29' height='30' />" +
"            <text text='(ID 975)' />" +
"          </hbox>" +
"          <text/>" +
"        </vbox>" +
"      </scrollarea>" +
"    </vbox>" +
"  </container>" +
"</window>"

#XML = 0
#Dialog = 0

If CatchXML(#Xml, @XML$, StringByteLength(XML$)) And XMLStatus(#Xml) = #PB_XML_Success
  
  If CreateDialog(#Dialog) And OpenXMLDialog(#Dialog, #Xml, "test")
    
    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 for any ideas / feedback! :D
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: Dialog XML creation - Changes in processing with PB5.40?

Post by davido »

@Andre,
Tried your code on my MacBook Pro.
1. Flags an error unless the first line of the dialog - "<?xml version='1.0' encoding='ISO-8859-1' ?>" + - is removed.
2. Displayed window does not look right - most of the gadgets are not displayed.

Tried on Windows 7 - does not even display a window!
DE AA EB
infratec
Always Here
Always Here
Posts: 7779
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Dialog XML creation - Changes in processing with PB5.40?

Post by infratec »

Win7

I had to remove the encoding from the headline,
I had to use unicode, then you can see the 'small' window when you place the mouse over the taskbar icon.
Strange.
I'll investigate this further.

Bernd
Last edited by infratec on Wed Oct 28, 2015 8:08 am, edited 1 time in total.
infratec
Always Here
Always Here
Posts: 7779
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Dialog XML creation - Changes in processing with PB5.40?

Post by infratec »

Found it:

You used #PB_Window_WindowCentered
Replace it with #PB_Window_ScreenCentered and you see the window (Win7)

Now to the Gadgets ...

Bernd
infratec
Always Here
Always Here
Posts: 7779
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Dialog XML creation - Changes in processing with PB5.40?

Post by infratec »

If you remove the ScrollArea you see the gadgets.
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: Dialog XML creation - Changes in processing with PB5.40?

Post by davido »

@infratec,
Thanks Sherlock!
Nearly went cross-eyed looking for the bug.

Edit: Just saw you last post.
Works fine, now.
DE AA EB
infratec
Always Here
Always Here
Posts: 7779
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Dialog XML creation - Changes in processing with PB5.40?

Post by infratec »

Thanks Watson.

The main point is definately the ScrollArea.
Maybe Fred forgot to close the gadgetlist.

Btw. I didn't found any special help about dialogs.
Maybe I'm blind.
At the moment I can only guess about the complete syntax.
Any hints :?:

Bernd
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: Dialog XML creation - Changes in processing with PB5.40?

Post by davido »

@infratec,
:)
Should the problem with the ScrollArea gadget be flagged as a bug?
Also on the Mac the ButtonImage gadget has a horizontal-flipped E. Windows 7 shows just a black button as would be expected.
Should this be flagged as a bug?
DE AA EB
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2158
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Re: Dialog XML creation - Changes in processing with PB5.40?

Post by Andre »

Thanks guys for your tests and comments.
As I'm currently only on my mobile phone I can't test myself.

But I would classify these problems as bug(s), as
- the gadgets were displayed inside the scrollarea with PB 5.31
- the not working window centering seems to be known, see here

The other ones I can't say without more testing...
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
infratec
Always Here
Always Here
Posts: 7779
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Dialog XML creation - Changes in processing with PB5.40?

Post by infratec »

Hi,

window cenetering is working.
But you used WindowCentered without a parent window.
So ScreenCentered would be the right flag.

Bernd
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2158
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Re: Dialog XML creation - Changes in processing with PB5.40?

Post by Andre »

I reworked my code a bit (removed the Encoding line in XML definition + used encoding settings according to actual help example, removed the '...WindowCentered' flag even if PB5.31 didn't complain) and added example images to illustrate their reserved space better. And most important: deactivated the 'ScrollArea' which really seems to be buggy in PB5.40 (when used in a Dialog), as it worked without any problems with PB5.31 - will make a bug-report about this.... => see here: http://www.purebasic.fr/english/viewtop ... =4&t=63871

Here is the code:

Code: Select all

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

#Dialog = 0
#Xml = 0
  
XML$ +
"<window id='#PB_Any' name='test' minwidth='500' minheight='410' text='Informationen über die Welterbestätte: Zeche Zollverein und Kokerei Zollverein in Essen' flags='#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_SizeGadget'>" +
"  <container name='WHContainer' flags='#PB_Container_Single'>" +
"    <vbox align='center' spacing='0' expand='item:2'>" +
"      <hbox align='left' spacing='3' expand='item:1'>" +
"        <vbox align='left' spacing='2' expand='item:2'>" +
"          <text name='WHNameTitle' text='Welterbestätte:' width='103' height='17'  />" +
"          <hbox align='left' spacing='2' expand='item:3'>" +
"            <empty/><empty/>" +
"            <text name='WHName' text='Zeche Zollverein und Kokerei Zollverein in Essen' />" +
"          </hbox>" +
"          <text/>" +
"        </vbox>" +
"        <singlebox align='center' expand='no' margin='0'>" +
"          <buttonimage name='WHListImage' width='22' height='22' />" +
"        </singlebox>" +
"      </hbox>" +
;"      <scrollarea flags='#PB_ScrollArea_Single'>" +     ; <====== ScrollArea seems to be buggy in PB5.40 (this XML definition worked with PB5.31 !!!)
"        <vbox align='left' spacing='0'>" +
"          <text name='WHNameIntTitle' text='Internationaler Name:' width='136' height='17'  />" +
"          <hbox align='left' spacing='2' expand='item:3'>" +
"            <empty/><empty/>" +
"            <text name='WHNameInt' text='Zollverein Coal Mine Industrial Complex in Essen' />" +
"          </hbox>" +
"          <text/>" +
"          <text name='WHRegionTitle' text='Region:' width='59' height='17'  />" +
"          <hbox align='left' spacing='3' expand='item:3'>" +
"            <empty/><empty/>" +
"            <text text='Europa & Nordamerika' />" +
"          </hbox>" +
"          <text/>" +
"          <text name='WHTypeTitle' text='Typ:' width='41' height='17'  />" +
"          <hbox align='left' spacing='3' expand='item:3'>" +
"            <empty/><empty/>" +
"            <text text='Kultur-Welterbestätte' />" +
"          </hbox>" +
"          <text/>" +
"          <text name='WHStatusTitle' text='Status:' width='56' height='17'  />" +
"          <hbox align='left' spacing='3' expand='item:3'>" +
"            <empty/><empty/>" +
"            <text text='2001 aufgenommen (25. Sitzung)' />" +
"          </hbox>" +
"          <text/>" +
"          <text name='WHPosTitle' text='Lage' width='45' height='17'  />" +
"          <hbox align='left' spacing='3' expand='item:4'>" +
"            <empty/><empty/>" +
"            <text text='Kontinent:' />" +
"            <hyperlink name='WHContinent' text='Europa' flags='#PB_HyperLink_Underline' />" +
"          </hbox>" +
"          <hbox align='center' spacing='3' expand='no'>" +
"            <empty/><empty/>" +
"            <text text='Land:' />" +
"            <hyperlink name='WHCountry1' text=' Deutschland ' flags='#PB_HyperLink_Underline' />" +
"          </hbox>" +
"          <text/>" +
"          <text name='WHCoordinatesTitle' text='Geografische Koordinaten:' width='165' height='17'  />" +
"          <hbox align='left' spacing='3' expand='item:3'>" +
"            <empty/><empty/>" +
"            <text text='51,49° Nord, 7,05° Ost' />" +
"          </hbox>" +
"          <text/>" +
"          <hbox align='center' spacing='3' expand='item:3'>" +
"            <empty/><empty/>" +
"            <image name='WHMapImage' width='240' height='120' />" +
"          </hbox>" +
"          <text/>" +
"          <text name='WHAddInfoTitle' text='Weitere Informationen:' width='145' height='17'  />" +
"          <hbox align='left' spacing='3' expand='item:3'>" +
"            <empty/><empty/>" +
"            <hyperlink name='WHUnescoLink' text='Link zur UNESCO-Welterbe-Seite' flags='#PB_HyperLink_Underline' />" +
"            <image name='WHLogoImage' width='29' height='30' />" +
"            <text text='(ID 975)' />" +
"          </hbox>" +
"          <text/>" +
"        </vbox>" +
;"      </scrollarea>" +
"    </vbox>" +
"  </container>" +
"</window>"
  
If CatchXML(#Xml, @XML$, StringByteLength(XML$), 0, #XmlEncoding) And XMLStatus(#Xml) = #PB_XML_Success
  
  If CreateDialog(#Dialog) And OpenXMLDialog(#Dialog, #Xml, "test")
    
    gad = DialogGadget(#Dialog, "WHMapImage")
    If gad
      If CreateImage(0, 240, 120) And StartDrawing(ImageOutput(0))
        Box(0, 0, 240, 120, $FF2244)
        Box(5, 5, 230, 110, $FFFFFF)
        StopDrawing()
        SetGadgetState(gad, ImageID(0))
      EndIf
    EndIf
    
    gad = DialogGadget(#Dialog, "WHLogoImage")
    If gad
      If CreateImage(1, 29, 30) And StartDrawing(ImageOutput(1))
        Box(0, 0, 29, 30, $2244FF)
        Box(3, 3, 23, 24, $FFFFFF)
        StopDrawing()
        SetGadgetState(gad, ImageID(1))
      EndIf
    EndIf
    
    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
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
Korolev Michael
Enthusiast
Enthusiast
Posts: 200
Joined: Wed Feb 01, 2012 5:30 pm
Location: Russian Federation

Re: Dialog XML creation - Changes in processing with PB5.40?

Post by Korolev Michael »

The following XML code is programmatically created by my application
Do u have own XML designer? Can u share it?
Former user of pirated PB.
Now registered user :].
Post Reply