Hi all,
I am not sure if this is related the HMG, but please share your thoughts.
I call a procedure & pass an array in the following manner:
SetButtonStatus({ ,;
{'Add',.t.} ,;
{'Edit',.t.} ,;
{'Save',.t.} ,;
{'Cancel',.t.} ,;
{'Delete',.t.} ,;
{'Close',.t.} })
Static Procedure SetButtonStatus(aButtons)
local nI ,;
cForm ,;
cButton
for nI = 1 to Len(aButtons)
cForm := 'Main'
cButton := 'Button_'+aButtons[nI,1]
SetProperty(cForm, cButton, "ENABLED", aButtons[nI,2])
next
Return
I get the "Error BASE/1068 Argument error: array access" on this line:
cButton := 'Button_'+aButtons[nI,1]
Thanks.
array parameter
Moderator: Rathinagiri
Re: array parameter
Hi,
There is a typo in the following string:
SetButtonStatus({ ,; // <-- spare comma
..
BTW Please take a look for the working sample below:
Hope that helps
There is a typo in the following string:
SetButtonStatus({ ,; // <-- spare comma
..
BTW Please take a look for the working sample below:
Code: Select all
/*
* MINIGUI - Harbour Win32 GUI library Demo
*/
#include "minigui.ch"
Function Main()
DEFINE WINDOW Form_1 ;
AT 0,0 ;
WIDTH 640 ;
HEIGHT 480 ;
MAIN;
TITLE 'Button Test'
@ 10,100 BUTTON Button_1 CAPTION "Add" WIDTH 80 HEIGHT 24 ACTION MsgInfo('Test!')
@ 40,100 BUTTON Button_2 CAPTION "Edit" WIDTH 80 HEIGHT 24 ACTION SetButtonStatus('Form_1', ;
{{'Button_1',.t.} ,;
{'Button_2',.t.} ,;
{'Button_3',.t.} ,;
{'Button_4',.t.} ,;
{'Button_5',.f.} ,;
{'Button_6',.t.} })
@ 70,100 BUTTON Button_3 CAPTION "Save" WIDTH 80 HEIGHT 24 ACTION MsgInfo('Test!')
@ 100,100 BUTTON Button_4 CAPTION "Cancel" WIDTH 80 HEIGHT 24 ACTION MsgInfo('Test!')
@ 130,100 BUTTON Button_5 CAPTION "Delete" WIDTH 80 HEIGHT 24 ACTION MsgInfo('Test!')
@ 160,100 BUTTON Button_6 CAPTION "Close" WIDTH 80 HEIGHT 24 ACTION ThisWindow.Release()
END WINDOW
SetButtonStatus('Form_1',;
{;
{'Button_1',.t.} ,;
{'Button_2',.t.} ,;
{'Button_3',.f.} ,;
{'Button_4',.f.} ,;
{'Button_5',.t.} ,;
{'Button_6',.t.} ;
})
CENTER WINDOW Form_1
ACTIVATE WINDOW Form_1
Return Nil
Static Procedure SetButtonStatus(cForm, aButtons)
local nI
for nI = 1 to Len(aButtons)
SetProperty(cForm, aButtons[nI,1], "ENABLED", aButtons[nI,2])
next
Return
Kind Regards,
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Re: array parameter
Hi gfilatov,
Thanks!
Don't know how I could have missed the ,.
Thanks!
Don't know how I could have missed the ,.