REDEFINE BTNBMP Within FOR NEXT LOOP
Posted: Sat Jul 27, 2019 12:07 pm
I have quite a lot of On/Off settings to include so was hoping to set them up using a for next loop
but I'm gettting a bound array error (n=3) on selection
Can this be done if so what do I need to change
Thanks
Peter
but I'm gettting a bound array error (n=3) on selection
Can this be done if so what do I need to change
Thanks
Peter
Code: Select all
#include "FiveWin.ch"
function Main()
LOCAL oBtn[2]
LOCAL oDlg
LOCAL lOn := {.f.,.t.}
LOCAL n
DEFINE DIALOG oDlg RESOURCE 'DIALOG1'
FOR n = 1 to 2
REDEFINE BTNBMP oBtn[n] CENTER NOBORDER UPDATE ID 4029 + n OF oDlg ;
RESOURCE IIF( lOn[n], 8002,8001 ) ACTION ( lOn[n] := ! lOn[n],::SetImages(IIF( lOn[n], 8002,8001 )),ShowStatus(lOn[n]))
NEXT
ACTIVATE DIALOG oDlg
RETURN nil
FUNCTION ShowStatus(lOn)
@ 6,1 SAY IIF(lOn,"On ","Off")
RETURN NIL