Search found 7 matches

by PureMoxie
Sat Aug 14, 2021 12:54 am
Forum: Getting Started with LiveCode - Experienced Developers
Topic: load script only stack and call one of its functions
Replies: 10
Views: 6087

Re: load script only stack and call one of its functions

Ah, I got it - a function must return something. I hadn't gotten that far and was just putting something out to the message window in my function. I also see that a handler makes more sense anyway if no return value is needed. Also, I think I read somewhere to always put preOpenStack in a card scrip...
by PureMoxie
Fri Aug 13, 2021 11:41 pm
Forum: Getting Started with LiveCode - Experienced Developers
Topic: load script only stack and call one of its functions
Replies: 10
Views: 6087

Re: load script only stack and call one of its functions

Thanks, Paul - I tried updating to the code below (spaces around dots in file name are for getting past the forum software) but am still getting "can't find handler:" on preOpenStack start using stack "C:\Users\chris\Documents\My LiveCode\dbLib . livecodescript" put stacksinuse insert the script of ...
by PureMoxie
Fri Aug 13, 2021 10:11 pm
Forum: Getting Started with LiveCode - Experienced Developers
Topic: load script only stack and call one of its functions
Replies: 10
Views: 6087

load script only stack and call one of its functions

Hi, As I start doing more things with LC, I have noticed I am using a lot of the same database code across projects. So, I want to move a lot of that into a script-only stack that I can use as a library. I am trying to set a custom property on a normal stack that will store the database name used fo...
by PureMoxie
Tue Feb 23, 2021 5:47 pm
Forum: Getting Started with LiveCode - Complete Beginners
Topic: storing hidden id with Option Menu
Replies: 10
Views: 4555

Re: storing hidden id with Option Menu

Thanks, Klaus, makes sense! I also figured out a little function to return an array's key when passed an array and a value. It assumes unique values (it would only return the first match otherwise), but it does what I need in this case. function keyByValue pArray pValue repeat for each line tKey in ...
by PureMoxie
Tue Feb 23, 2021 4:31 pm
Forum: Getting Started with LiveCode - Complete Beginners
Topic: storing hidden id with Option Menu
Replies: 10
Views: 4555

Re: storing hidden id with Option Menu

Okay, so I now have populated a custom property for the Option Menu from my database query with the row id and the option text, for example cOptions[1] = 'option1' and cOptions[2] = 'option2'. Now my question is if it is possible to retrieve the key from a given value so that if the selected menu op...
by PureMoxie
Mon Feb 22, 2021 6:14 pm
Forum: Getting Started with LiveCode - Complete Beginners
Topic: storing hidden id with Option Menu
Replies: 10
Views: 4555

Re: storing hidden id with Option Menu

Ah, glad I asked. I hadn't gotten to custom properties yet, but this indeed looks like the way to go. Thanks!
by PureMoxie
Mon Feb 22, 2021 5:14 pm
Forum: Getting Started with LiveCode - Complete Beginners
Topic: storing hidden id with Option Menu
Replies: 10
Views: 4555

storing hidden id with Option Menu

Greetings, I am coming from a web development background. In html, the selected value of an option menu can be different than the displayed text for the menu item: <option value="1">Red</option> Let's say I have a db table products with a column called color_id that references another table called c...