How to programmatically change object event method ? 
Author Message
 How to programmatically change object event method ?

Hello !
I have grid in the form

Now I want change the in the form's init method Column1.Header1.Click()
event

like

THISFORM.Grid1.Column1.Header1.Click()="some_function()"

But compiler gives "syntax error"
Any suggestions ?

Kuido



Sat, 01 Feb 2003 03:00:00 GMT  
 How to programmatically change object event method ?
You *could* do what you want by adding a property to the form called
FunctionToCall which is a string.  Then, in the Init, you could set it,
like:

   THISFORM.FunctionToCall = "somefunction()"

Then, in the click of the object, you could call the function, like:

   LOCAL cFunc
   cFunc = THISFORM.FunctionToCall
   &cFunc

But, there may be more elegant was to do it, however.  How many possible
functions could be called from the click, and in what circumstances?

- John

In article


Quote:
>Hello !
>I have grid in the form

>Now I want change the in the form's init method Column1.Header1.Click()
>event

>like

>THISFORM.Grid1.Column1.Header1.Click()="some_function()"

>But compiler gives "syntax error"
>Any suggestions ?

>Kuido



Sat, 01 Feb 2003 03:00:00 GMT  
 How to programmatically change object event method ?
Place the changing code in a case statement in a method of another object
(the form, for example).  So at design time you can call
ThisForm.ClickHandler() in the click()

alternativley use eval, thus:

in the button::click()

return eval(This.cClickCommand)

where cClickCommand is a property on your button class.

Macro expansion would work in a similar way to the eval trick.

John.


Quote:
> Hello !
> I have grid in the form

> Now I want change the in the form's init method Column1.Header1.Click()
> event

> like

> THISFORM.Grid1.Column1.Header1.Click()="some_function()"

> But compiler gives "syntax error"
> Any suggestions ?

> Kuido



Sat, 01 Feb 2003 03:00:00 GMT  
 How to programmatically change object event method ?

Quote:
> You *could* do what you want by adding a property to the form called
> FunctionToCall which is a string.  Then, in the Init, you could set it,
> like:

>    THISFORM.FunctionToCall = "somefunction()"

> Then, in the click of the object, you could call the function, like:

>    LOCAL cFunc
>    cFunc = THISFORM.FunctionToCall
>    &cFunc

> But, there may be more elegant was to do it, however.  How many possible
> functions could be called from the click, and in what circumstances?

My problem is that in the I compose Forms's grid dynamically in the Form's
init method.
Using table I make some table fields the Grid colums like this..

LOCAL ko
THISFORM.abi=ALIAS()
WITH THISFORM.Grid1
  .RecordSourceType=1
  .RecordSource=THISFORM.abi
  .ColumnCount=FCOUNT(THISFORM.abi)-1
  .Column1.ControlSource="perenimi"
  .Column2.ControlSource="eesnimi"
   FOR ko=4 TO FCOUNT(THISFORM.abi)
           .Columns[ko-1].Header1.Caption=FIELD(ko,THISFORM.abi)
           .Columns[ko-1].ControlSource=FIELD(ko,THISFORM.abi)
           .Columns[ko-1].Width=80

           && .Columns[ko-1].Header1.Click()="opper(FIELD(ko,THISFORM.abi))"

   ENDFOR
ENDWITH

Now I want, that If I click some column header invoke function "opper".

Kuido



Sun, 02 Feb 2003 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. - changing form object properties with refresh method - beginner's question

2. add custom method programmatically

3. add method code programmatically with grids

4. Adding a LostFocus Event To A Combobox Programmatically

5. How to define Header.RightClick Event programmatically?

6. adding event code programmatically

7. Programmatically defining events

8. Adding objects to a form programmatically

9. Programmatically creating code behind a created object.

10. Change printer setting of report form programmatically

11. how to change printer programmatically

12. changing browse window size programmatically

 

 
Powered by phpBB® Forum Software