Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to stop the action by pressing another button ?
Message
 
To
02/11/2006 08:47:05
Hee Lim Wang
Fantasy Software Enterprise
Malaysia
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
01166500
Message ID:
01166582
Views:
19
>i cannot click the stop button because the mouse pointer showing a waiting icon

try (VFP9)
oForm = CREATEOBJECT([Form1])
oForm.Show(1)

DEFINE CLASS form1 AS form


    DoCreate = .T.
    bcancelloop = .F.
    Name = "form1"
    ADD OBJECT command1 AS commandbutton WITH ;
        Top = 125, ;
        Left = 8, ;
        Height = 27, ;
        Width = 111, ;
        Caption = "Start Loop", ;
        Name = "Command1"


    ADD OBJECT command2 AS commandbutton WITH ;
        Top = 125, ;
        Left = 130, ;
        Height = 27, ;
        Width = 111, ;
        Caption = "Cancel Loop", ;
        Name = "Command2"


    ADD OBJECT label1 AS label WITH ;
        AutoSize = .T., ;
        Caption = "Press START", ;
        Height = 17, ;
        Left = 31, ;
        Top = 45, ;
        Width = 40, ;
        Name = "Label1"


    PROCEDURE command1.Click
        thisform.bCancelloop = .f.
        lnCounter = 0
        DO WHILE .t.
           lnCounter = lnCounter + 1
           thisform.Label1.Caption = TRANSFORM(lnCounter)
           DOEVENTS
           IF thisform.bCancelloop
               thisform.Label1.Caption = [Loop is canceled]
              EXIT
           ENDIF
        ENDDO
            
    ENDPROC


    PROCEDURE command2.Click
        thisform.bCancelloop = .t.
    ENDPROC


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

Click here to load this message in the networking platform