nach längerer Zeit und da ich gerade diese auch habe, wollte ich mich mit dem XML Dialog beschäftigen.
Seit mehreren Tagen versuche ich dabei ein Dialog, in dem drei untereinander stehende StringGadget mit voranstehenden Informationen (TextGadget), zu bauen.
Irgendwie klappt das nicht so wie ich es will, alle Gadget bleiben in einer Zeile.
Code: Alles auswählen
Procedure.s mEingabe (vE1.s=#Null$, vE2.s=#Null$, vE3.s=#Null$, vWinID.i = #Null)
Protected n.i, pQuit.a, pXMLData.s, pReturn.s, pEvent.i
Protected pXmlID.i = Random (99,1)
Protected pWinFlag.s = "#PB_Window_ScreenCentered"
Protected pWindowID.i = pXmlID + 1
Protected pDialogID.i = pXmlID + 2
Protected pStr1ID.i = pXmlID + 3
Protected pStr2ID.i = pXmlID + 4
Protected pStr3ID.i = pXmlID + 5
If vWinID: pWinFlag = "#PB_Window_WindowCentered": EndIf
pXMLData = "<window id='" + pWindowID + "' name='Eingabe'" +
" text='Eingabedaten'" +
" minwidth='240' maxwidth='240'" +
" minheight='150' maxheight='150'" +
" flags='" + pWinFlag + "'>" +
" <vbox height='30' expand='item:3'>" +
" <hbox width='100' expand='item:2'>" +
" <text text='Eingabe 1:'/>" +
" <string id='" + pStr1ID + "'/>" +
" <text text='Eingabe 2:'/>" +
" <string id='" + pStr2ID + "'/>" +
" <text text='eingabe 3:'/>" +
" <string id='" + pStr3ID + "'/>" +
" </hbox>" +
" </vbox>" +
"</window>"
If ParseXML(pXmlID, pXMLData) And XMLStatus(pXmlID) = #PB_XML_Success
If CreateDialog(pDialogID) And OpenXMLDialog(pDIALOGID, pXmlID, "Eingabe")
For n=pstr1ID To pstr3ID
SetGadgetFont(n, FontID(LoadFont(#PB_Any, "Courier new", 12)))
Next n
AddKeyboardShortcut(pWindowID, #PB_Shortcut_Return, #True)
AddKeyboardShortcut(pWindowID, #PB_Shortcut_Escape, #False)
SetActiveGadget(pStr1ID)
StickyWindow (pWindowID, #True)
Repeat
pEvent = WaitWindowEvent()
Select pEvent
Case #PB_Event_CloseWindow: pQuit = #True
Case #PB_Event_Menu
If EventMenu()
; noch zu entwickeln
EndIf
pQuit = #True
EndSelect
Until pQuit
CloseWindow(pWindowID)
Else
Debug "Dialog error: " + DialogError(pDialogID)
EndIf
Else
Debug "XML error: " + XMLError(pXmlID) + " (Line: " + XMLErrorLine(pXmlID) + ")"
EndIf
ProcedureReturn pReturn
EndProcedure
mEingabe()