OOABL - Capturing Event

Posted by Admin on 26-Apr-2008 09:53

def button a.

def frame b a.

run a.p persistent (input a:handle).

enable all.

wait-for 'choose' of a.

/* a.p */

def input parameter ip-handle as handle no-undo.

on 'choose' of ip-handle

do:

message 'test' view-as alert-box.

end.

How to do the same thing with classes (The OOABL way)?

Below code doesn't work:

CLASS test-b:

DEF BUTTON a.

DEF FRAME b a.

DEF VAR c AS CLASS click.

CONSTRUCTOR test-b():

DO WITH FRAME b:

ENABLE ALL.

c = NEW click(a:HANDLE).

WAIT-FOR 'choose' OF a.

END.

END CONSTRUCTOR.

END CLASS.

/* click.cls */

CLASS click:

CONSTRUCTOR click(INPUT ip-handle AS HANDLE):

ON 'choose':U OF ip-handle

DO:

MESSAGE 'test'

VIEW-AS ALERT-BOX INFO BUTTONS OK.

END.

END CONSTRUCTOR.

END CLASS.

Thanks,

Parul.

All Replies

Posted by Admin on 28-Apr-2008 02:33

Hi,

I think u should make a seprate CLASS for Button and and related events.

And, seprate Class for Frame , that will contain a instance on Button Class.

This method of coding in OOPs is called Deligation.

According to ecapsulation, write every thing of Class i.e. Method and attribute

of that entity in a single class.

For your Code :

Make two class (it is not exact code , it is just dummy code).

Class bButton:

/* Define button here and set the attribute write method to run trigger (not

in constructor ) */

End class.

Second Class:

Class fFrame :

/* Define variable For button class.

Create object of button in constructor of frame. */

End Class.

I think no need to run persistently. I think it will help You.

This thread is closed