Page 1 of 1
How to display a modal dialogwindow from XPorted VO Code?
Posted: Fri Jul 14, 2023 9:55 am
by stefan.ungemach
I have a simple modal window which inherited from a DialogWIndow in VO code. The modal behaviour comes from the constructor:
CLASS KOBOptionBox_vo INHERIT DIALOGWINDOW
CONSTRUCTOR(oParent,uExtra)
LOCAL DIM aBrushes[1] AS OBJECT
SELF:PreInit(oParent,uExtra)
SUPER(oParent,ResourceID{"KOBOptionBox_vo",_GetInst()},TRUE)
Unfortunately the window opens with :Show(SHOWCENTERED), but closes immediately. Before designing a whole new user interface: Is there any simple thing I did wrong?
...
How to display a modal dialogwindow from XPorted VO Code?
Posted: Fri Jul 14, 2023 11:32 am
by robert
Stefan,
Is there a postinit method for the window? Does it get called?
Maybe there is an exception. Can you add a try .. catch around the call to Show() to see if an exception occurs?
Robert
How to display a modal dialogwindow from XPorted VO Code?
Posted: Mon Jul 17, 2023 8:24 am
by stefan.ungemach
Robert,
the PostInit is called. The window gets displayed as well (which I can prove both by the debugger and by commenting the last line here:
oDlg := KOBMsgOptionBox{ oWin }
oDlg:Caption := cCaption
oDlg:TextZeilen := aMsg
oDlg:ID := cDialogKennungFuerAutoAntwort
oDlg:EscapeErlaubt := FALSE
oDlg:OldStyleFontSet := aFixedFont
oDlg:BitmapNameFuerFarbe := cBitmap
oDlg:Show(SHOWCENTERED)
// oDlg:destroy()
Problem is: it's not modal. In VO, the program execution halts after the show until the window is closed. In X# execution continues immediately, the destroy() is called and the window gone.
How to display a modal dialogwindow from XPorted VO Code?
Posted: Mon Jul 17, 2023 8:54 am
by robert
Stefan,
Can you send us an example so we can test it?
Robert
How to display a modal dialogwindow from XPorted VO Code?
Posted: Mon Jul 17, 2023 10:07 am
by stefan.ungemach
Robert,
an example would be too complex - but the problem is solved. I didn't have an app object, thus no message loop (this worked fine for Xported server apps without any GUI). After inserting
IF getAppObject() == NULL_OBJECT
VOGUIClasses.Functions.__WCInitCriticalSections()
VOGUIClasses.Functions.__InitFunctionPointer()
VOGUIClasses.Functions.__WCRegisterCustomControl()
VOGUIClasses.Functions.__InitClassPointer()
VOGUIClasses.Functions.__WCRegisterMMContWindow()
VOGUIClasses.Functions.__InitTheme()
App{}
ENDIF
and
IF !empty( getAppObject() )
getAppObject():Exec( EXECWHILEEVENT )
ENDIF
before my test code, the modal windows (custom message boxes) appear. I hope this was the right approach