customKeys and recalling the data in a key

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
mrcoollion
Posts: 743
Joined: Thu Sep 11, 2014 1:49 pm

customKeys and recalling the data in a key

Post by mrcoollion » Tue Apr 21, 2026 11:12 am

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 :shock: 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

Klaus
Posts: 14313
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: customKeys and recalling the data in a key

Post by Klaus » Tue Apr 21, 2026 1:34 pm

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

mrcoollion
Posts: 743
Joined: Thu Sep 11, 2014 1:49 pm

Re: customKeys and recalling the data in a key

Post by mrcoollion » Tue Apr 21, 2026 2:09 pm

Never would have thought of this.

Dankjewel (Thank you) Klaus.

mrcoollion
Posts: 743
Joined: Thu Sep 11, 2014 1:49 pm

Re: customKeys and recalling the data in a key

Post by mrcoollion » Tue Apr 21, 2026 2:45 pm

Sorry Klaus, still does not work.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10487
Joined: Wed May 06, 2009 2:28 pm

Re: customKeys and recalling the data in a key

Post by dunbarx » Tue Apr 21, 2026 4:44 pm

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

Klaus
Posts: 14313
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: customKeys and recalling the data in a key

Post by Klaus » Tue Apr 21, 2026 6:16 pm

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
cp_from_menu.png
?

Post Reply