How to disable a Button on the Fly / while runtime

Post Reply
User avatar
anserkk
Posts: 1333
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India
Has thanked: 2 times

How to disable a Button on the Fly / while runtime

Post by anserkk »

Friends,

I am not able to disable a button on the fly.

I am able to disable the button while defining the button with When .F.

Code: Select all | Expand

@3,20 BUTTON oBtn2 PROMPT "Close" SIZE 40,12 ACTION  { Dlg:End() }


But not possible to disable Button on the fly with the following code

Code: Select all | Expand

@01,01 PROGRESS oProg POSITION 0 SIZE 255, 10
@03,10 BUTTON oBtn  PROMPT "Reindex" SIZE 40,12 ACTION  {oBtn2:bWhen:={ || .F.},SysRefresh(), ;DoIndexing(lAutoIndex,oDlg,oProg,oSay1,oSay2,oSay3) } DEFAULT
@03,20 BUTTON oBtn2 PROMPT "Close"    SIZE 40,12 ACTION  {  oDlg:End() } 


Any help ?

Regards

Anser
User avatar
Patrick Mast
Posts: 246
Joined: Sat Mar 03, 2007 8:42 pm

Re: How to disable a Button on the Fly / while runtime

Post by Patrick Mast »

Hello Anser,

anserkk wrote:Friends,

I am not able to disable a button on the fly.

I am able to disable the button while defining the button with When .F.

Code: Select all | Expand

@3,20 BUTTON oBtn2 PROMPT "Close" SIZE 40,12 ACTION  { Dlg:End() }


But not possible to disable Button on the fly with the following code

Code: Select all | Expand

@01,01 PROGRESS oProg POSITION 0 SIZE 255, 10
@03,10 BUTTON oBtn  PROMPT "Reindex" SIZE 40,12 ACTION  {oBtn2:bWhen:={ || .F.},SysRefresh(), ;DoIndexing(lAutoIndex,oDlg,oProg,oSay1,oSay2,oSay3) } DEFAULT
@03,20 BUTTON oBtn2 PROMPT "Close"    SIZE 40,12 ACTION  {  oDlg:End() } 


Any help ?


Use oBtn2:Disable() instead of {oBtn2:bWhen:={ || .F.},SysRefresh()

Patrick
User avatar
anserkk
Posts: 1333
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India
Has thanked: 2 times

Post by anserkk »

Thankyou Mr.Patric

Use oBtn2:Disable() instead of {oBtn2:bWhen:={ || .F.},SysRefresh()


Your solution worked.

Anser
Post Reply