Page 1 of 1
customKeys and recalling the data in a key
Posted: Tue Apr 21, 2026 11:12 am
by mrcoollion
It has been a while that i have been on this forum, so hello to you all LiveCoder's

.
I do come here for the following reason.
I thought it was a good idea to save fixed data within a menupick button using customKeys. However i cannot seem to get it working .
The code does not give me errors but also i do not get anything in field "TextField" . The target field "TextField" is made empty

but no text that is kept in customKeys .
So here is the simple code for test. What do i do wrong ?
Code: Select all
on menuPick itemPicked
switch itemPicked
case "1st Text"
put the customKeys["1st Text"] of me into fld "TextField"
break
end switch
end menuPick
Regards,
Paul
Re: customKeys and recalling the data in a key
Posted: Tue Apr 21, 2026 1:34 pm
by Klaus
Dag Paul,
to retrieve a CP with a name with more than one word, you need to use a variable to do so!
This works:
Code: Select all
on menuPick itemPicked
switch itemPicked
case "1st Text"
get "1st text"
put the IT of me into fld "TextField"
break
end switch
end menuPick
Groetjes
Klaus
Re: customKeys and recalling the data in a key
Posted: Tue Apr 21, 2026 2:09 pm
by mrcoollion
Never would have thought of this.
Dankjewel (Thank you) Klaus.
Re: customKeys and recalling the data in a key
Posted: Tue Apr 21, 2026 2:45 pm
by mrcoollion
Sorry Klaus, still does not work.
Re: customKeys and recalling the data in a key
Posted: Tue Apr 21, 2026 4:44 pm
by dunbarx
I also cannot get the alternate form to give anything but empty. That alternate form is given as an example , but not listed in the property syntax, which is simply
put the customKeys of me into fld "TextField"
Craig
Re: customKeys and recalling the data in a key
Posted: Tue Apr 21, 2026 6:16 pm
by Klaus
Works here with a menu button, see screenshot.
I used the same example as Paul:
Code: Select all
on menuPick itemPicked
switch itemPicked
case "1st Text"
get "1st text"
put the IT of me
break
end switch
end menuPick
?
Re: customKeys and recalling the data in a key
Posted: Wed Apr 22, 2026 8:41 pm
by mrcoollion
I got it working.Added the following two menu items to a pulldown button
No clue why i did not get it working before. I added a new button and a new target field "TestTekst" and added the menu items below to the button .
1st Text
2nd Text
With the below code it worked
Code: Select all
on menuPick itemPicked
switch itemPicked
case "1st Text"
get "1st text"
put the IT of me into fld "TestTekst"
break
case "2nd Text"
get "2nd Text"
put the IT of me into fld "TestTekst"
break
end switch
end menuPick
Bedankt Klaus voor je hulp.
Re: customKeys and recalling the data in a key
Posted: Thu Apr 23, 2026 10:38 am
by bn
I was intrigued by this thread because I am always a bit confused by addressing the custom properties.
@Paul
You could simplify the script of button to:
Code: Select all
on menuPick itemPicked
put the itemPicked of me into field "testTekst"
end menuPick
Your first attempt did not work because you were addressing the "customKeys" in array fashion. CustomKeys is a list of the keys of the customProperties. CustomKeys is not an array.
If you would want to address the arrary you could do:
Code: Select all
on menuPick itemPicked
put the customProperties of me into tCustomA
put tCustomA[itemPicked] into field "testTekst"
end menuPick
Kind regards
Bernd
Re: customKeys and recalling the data in a key
Posted: Thu Apr 23, 2026 11:33 am
by Klaus
mrcoollion wrote: ↑Wed Apr 22, 2026 8:41 pm
I got it working.Added the following two menu items to a pulldown button
No clue why i did not get it working before. I added a new button and a new target field "TestTekst" and added the menu items below to the button .
1st Text
2nd Text
With the below code it worked
Code: Select all
on menuPick itemPicked
switch itemPicked
case "1st Text"
get "1st text"
put the IT of me into fld "TestTekst"
break
case "2nd Text"
get "2nd Text"
put the IT of me into fld "TestTekst"
break
end switch
end menuPick
Bedankt Klaus voor je hulp.
Graag gedaan!
