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?
-
- Posts: 71
- Joined: Thu Jul 15, 2021 10:46 am
- Location: Germany
How to display a modal dialogwindow from XPorted VO Code?
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
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
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
-
- Posts: 71
- Joined: Thu Jul 15, 2021 10:46 am
- Location: Germany
How to display a modal dialogwindow from XPorted VO Code?
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.
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?
Stefan,
Can you send us an example so we can test it?
Robert
Can you send us an example so we can test it?
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
-
- Posts: 71
- Joined: Thu Jul 15, 2021 10:46 am
- Location: Germany
How to display a modal dialogwindow from XPorted VO Code?
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
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
andIF getAppObject() == NULL_OBJECT
VOGUIClasses.Functions.__WCInitCriticalSections()
VOGUIClasses.Functions.__InitFunctionPointer()
VOGUIClasses.Functions.__WCRegisterCustomControl()
VOGUIClasses.Functions.__InitClassPointer()
VOGUIClasses.Functions.__WCRegisterMMContWindow()
VOGUIClasses.Functions.__InitTheme()
App{}
ENDIF
before my test code, the modal windows (custom message boxes) appear. I hope this was the right approachIF !empty( getAppObject() )
getAppObject():Exec( EXECWHILEEVENT )
ENDIF