Seite 1 von 1

Dialog, will nicht so wie ich

Verfasst: 20.02.2020 22:06
von topsoft
Hallo,
ich habe folgenden Code:

Code: Alles auswählen

#Dialog = 0
#Xml = 0
XML.s = "<window id='#PB_Any' name='test' text='test' minwidth='320' minheight='200' flags='#PB_Window_ScreenCentered | #PB_Window_SystemMenu | #PB_Window_SizeGadget'>" +
        "  <hbox>" +
        "    <vbox>" + 
        "      <editor name = 'text' text = 'Text' expand = 'yes'/>" +
        "      <button name = 'knopf1' text = 'Knopf 1' expand = 'no' maxheight = '10'/>" +
        "      <button name = 'knopf2' text = 'Knopf 2' expand = 'no' maxheight = '10'/>" +
        "    </vbox>" +
        "    <vbox>" +
        "      <image name='img' flags = '#PB_Image_Raised'/>" + 
        "    </vbox>" + 
        "  </hbox>" +
        "</window>"
  
If ParseXML(#Xml, XML) And XMLStatus(#Xml) = #PB_XML_Success
  If CreateDialog(#Dialog)
    If OpenXMLDialog(#Dialog, #Xml, "test")
      Repeat
        Event = WaitWindowEvent()
      Until Event = #PB_Event_CloseWindow 
    EndIf
  Else  
    Debug "Dialog error: " + DialogError(#Dialog)
  EndIf
Else
  Debug "XML error: " + XMLError(#Xml) + " (Line: " + XMLErrorLine(#Xml) + ")"
EndIf
End
Ich möchte das die Button gleich gross sind und im Verhältniss zum Editor Gadget eher klein. Es soll immer das Editor Gadget in der Höhe expandiert werden.
Auch sollen beide 'vbox' gleich breit sein egal wie breit das Fenster ist. Ich probiere jetzt schon eine ganze Weile und bekomme es nicht hin. Die Pb Hilfe zu Dialog finde ich nicht sehr ergiebig.

Bei mir sieht das so aus.
nach dem Programmstart:

Bild

etwas vergrößert:

Bild

Ist da noch irgendwo mehr Dokumentation verfügbar?
Ich habe mal wieder das Gefühl das ich was übersehe.

Gruß

Re: Dialog, will nicht so wie ich

Verfasst: 20.02.2020 23:04
von HeX0R
Probier's mal damit:
viewtopic.php?f=11&t=30657

Dann kannst Du "live" rumspielen.

Re: Dialog, will nicht so wie ich

Verfasst: 21.02.2020 13:20
von Andesdaf
Die expand-Attribute müssen den Boxen übergeben werden, nicht den Child-Elementen.

Code: Alles auswählen

#Dialog = 0
#Xml = 0
XML.s = "<window id='#PB_Any' name='test' text='test' minwidth='320' minheight='200' flags='#PB_Window_ScreenCentered | #PB_Window_SystemMenu | #PB_Window_SizeGadget'>" +
        "  <hbox expand='equal'>" +
        "    <vbox expand='item:1'>" +
        "      <editor name = 'text' text = 'Text'/>" +
        "      <button name = 'knopf1' text = 'Knopf 1' />" +
        "      <button name = 'knopf2' text = 'Knopf 2' />" +
        "    </vbox>" +
        "    <vbox>" +
        "      <image name='img' flags = '#PB_Image_Raised'/>" +
        "    </vbox>" +
        "  </hbox>" +
        "</window>"
 
If ParseXML(#Xml, XML) And XMLStatus(#Xml) = #PB_XML_Success
  If CreateDialog(#Dialog)
    If OpenXMLDialog(#Dialog, #Xml, "test")
      Repeat
        Event = WaitWindowEvent()
      Until Event = #PB_Event_CloseWindow
    EndIf
  Else 
    Debug "Dialog error: " + DialogError(#Dialog)
  EndIf
Else
  Debug "XML error: " + XMLError(#Xml) + " (Line: " + XMLErrorLine(#Xml) + ")"
EndIf
End