Dialog, will nicht so wie ich

Für allgemeine Fragen zur Programmierung mit PureBasic.
topsoft
Beiträge: 67
Registriert: 16.09.2004 11:55
Wohnort: nrw

Dialog, will nicht so wie ich

Beitrag 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ß
Skylake QuadCore i7 6700K @4400MHz, MSI Z170A Gaming M5, 64 GB DDR4 @ 2133MHz, B: Ramdisk 32GB, C: Raid0 SATA SSD 1TB, D: Raid0 M2 SSD 1TB, E: Raid0 HDD 8TB, 28" 4K @ RTX2080, Win10 X64
Benutzeravatar
HeX0R
Beiträge: 2960
Registriert: 10.09.2004 09:59
Computerausstattung: AMD Ryzen 7 5800X
96Gig Ram
NVIDIA GEFORCE RTX 3060TI/8Gig
Win10 64Bit
G19 Tastatur
2x 24" + 1x27" Monitore
Glorious O Wireless Maus
PB 3.x-PB 6.x
Oculus Quest 2
Kontaktdaten:

Re: Dialog, will nicht so wie ich

Beitrag von HeX0R »

Probier's mal damit:
viewtopic.php?f=11&t=30657

Dann kannst Du "live" rumspielen.
Andesdaf
Moderator
Beiträge: 2660
Registriert: 15.06.2008 18:22
Wohnort: Dresden

Re: Dialog, will nicht so wie ich

Beitrag 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
Win11 x64 | PB 6.00 (x64)
Antworten