TekkamanOmega
New Member
Hi,
I'm looking for a good solution to handling widget triggers and events in classes in 10.1C.
Currently I have a class frmFrame which has a Close button. (I'm trying to mimic MDI kind of behavior without having to use .NET components, just a frame with childframes is sufficient).
How could I best create a Choose event for the close button and ENTRY/LEAVE events for the whole frame itself (so I can apply the focus and blur methods).
I've tried writing an EventHandler class and also tried adding TRIGGER-phrases to the CREATE widget statment in the GUIFactory.
After this failed, I found a solution on these forums where you can just add ON statments in the class itself... but since I like to work with WIDGET-HANDLES, these HANDLES aren't initialized yet when the ON statment is being processed when instanciating the CLASS.
Can anyone help me with this.
Many thanks in advance,
Tekka.
I'm looking for a good solution to handling widget triggers and events in classes in 10.1C.
Currently I have a class frmFrame which has a Close button. (I'm trying to mimic MDI kind of behavior without having to use .NET components, just a frame with childframes is sufficient).
Code:
USING presentation.gui.Container.
USING presentation.gui.Controller.
USING presentation.gui.ToolBar.
CLASS presentation.gui.frmFrame INHERITS Container IMPLEMENTS interfaces.iFrame:
DEFINE PROTECTED VARIABLE hContent AS HANDLE NO-UNDO.
DEFINE PROTECTED VARIABLE hTitle AS HANDLE NO-UNDO.
DEFINE PROTECTED VARIABLE hButtonMin AS HANDLE NO-UNDO.
DEFINE PROTECTED VARIABLE hButtonMax AS HANDLE NO-UNDO.
DEFINE PROTECTED VARIABLE hButtonClose AS HANDLE NO-UNDO.
DEFINE PROTECTED VARIABLE cFrameName AS CHARACTER NO-UNDO.
CONSTRUCTOR PROTECTED frmFrame():
SUPER().
END CONSTRUCTOR.
DESTRUCTOR frmFrame():
IF VALID-HANDLE(hContent) THEN DO:
DELETE OBJECT hButtonClose.
DELETE OBJECT hTitle.
DELETE OBJECT hContent.
END.
END DESTRUCTOR.
METHOD PUBLIC VOID showFrame():
IF VALID-HANDLE(hContent) THEN
ASSIGN hContent:VISIBLE = TRUE.
END METHOD.
METHOD PROTECTED VOID loadTitleBar(cTitle AS CHAR):
DEFINE VARIABLE iButtonX AS INTEGER NO-UNDO.
ASSIGN hTitle = FactoryInstance:createText(hContent, " " + cTitle, hContent:WIDTH-PIXELS - 2, 20, 0, 0, 6, 15, 1)
iButtonX = hContent:WIDTH-PIXELS - 23
hButtonClose = FactoryInstance:createImageButton(hContent, "graphics\button_close.bmp", 18, 16, iButtonX, 1)
hTitle:MOVE-TO-BOTTOM().
END METHOD.
METHOD PUBLIC VOID blurFrame():
ASSIGN hTitle:BGCOLOR = 7.
END METHOD.
METHOD PUBLIC VOID focusFrame():
ASSIGN hTitle:BGCOLOR = 1.
hContent:MOVE-TO-TOP().
END METHOD.
METHOD PUBLIC ToolBar loadToolBar(hParent AS HANDLE):
RETURN NEW ToolBar().
END METHOD.
END CLASS.
How could I best create a Choose event for the close button and ENTRY/LEAVE events for the whole frame itself (so I can apply the focus and blur methods).
I've tried writing an EventHandler class and also tried adding TRIGGER-phrases to the CREATE widget statment in the GUIFactory.
After this failed, I found a solution on these forums where you can just add ON statments in the class itself... but since I like to work with WIDGET-HANDLES, these HANDLES aren't initialized yet when the ON statment is being processed when instanciating the CLASS.
Can anyone help me with this.
Many thanks in advance,
Tekka.