Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BindEvent and _Assign Methods
Message
 
To
18/07/2006 12:12:51
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01137275
Message ID:
01137292
Views:
17
This message has been marked as a message which has helped to the initial question of the thread.
>Hello,
>
>Is it possible to use BINDEVENTS from a class to control the "ENABLE_ASSIGN" event of another object ?
>
>I've tried
>
>BINDEVENT(loControl, "Enabled_Assign", This, "MyMethod")
>
>But VFP returns an error, because the Method does not exist.
>Note that I cannot add this method manually to each control.
>
>Is there another way ?
>TIA
>
>Cesar

Bind to Enabled property. Try:
* Mode MS-original

PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
RETURN


    **************************************************
*-- Form:            form1 (d:\all_zapl\test.scx)
*-- ParentClass:     form
*-- BaseClass:       form
*-- Time Stamp:      07/18/06 07:42:06 PM
*
DEFINE CLASS form1 AS form


    Top = 0
    Left = 0
    Height = 250
    Width = 373
    DoCreate = .T.
    Caption = "Form1"
    Name = "form1"


    ADD OBJECT check1 AS checkbox WITH ;
        Top = 33, ;
        Left = 30, ;
        Height = 17, ;
        Width = 223, ;
        Alignment = 0, ;
        Caption = "Click only here", ;
        Value = .T., ;
        Name = "Check1"


    ADD OBJECT check2 AS checkbox WITH ;
        Top = 66, ;
        Left = 31, ;
        Height = 17, ;
        Width = 198, ;
        Alignment = 0, ;
        Caption = "Command Enabled", ;
        Value = .T., ;
        Name = "Check2"


    ADD OBJECT command1 AS commandbutton WITH ;
        Top = 103, ;
        Left = 63, ;
        Height = 27, ;
        Width = 84, ;
        Caption = "Command1", ;
        Name = "Command1"


    PROCEDURE testassign
        thisform.Check2.Value = thisform.Command1.Enabled 
    ENDPROC


    PROCEDURE Init
        BINDEVENT(thisform.Command1,[Enabled],thisform,[TestAssign],1)
    ENDPROC


    PROCEDURE retyrnmyval
    ENDPROC


    PROCEDURE check1.Click
        thisform.Command1.Enabled = this.Value
    ENDPROC


ENDDEFINE
*
*-- EndDefine: form1
**************************************************
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform