One of the first things I tried with LiveCode Create was to replicate my decades-old ‘Wordless’ tool, the original ‘live wordcount’ text editor (literally; that’s where the live wordcount concept started ). Starting as basic as it gets: drop in a couple of fields, and add this as a card or stack script:
on idle
put the number of words of field “work” into field “count”
end idle
Embarrassingly simple, hmm? But it doesn’t work in Create if I build it from scratch – because the field are widgets? But opening a stack made in LiveCode 9.x does work – because the fields aren’t widgets? Errr… could someone point me at some reading matter to help me get my head around whatever this brave new difference is?
I feel like a real newbie myself, but a few things are starting to make sense.
If you go to the navigation column on the very left of the Create IDE the first icon brings up the Tools Palette. The second icon is the Project Browser so click on that. This gives you a hierarchical view of the stack structure and all of its controls etc. (not unlike the browser in Classic).
The top listing is for the stack as a whole, and the third column lists the number of lines of script (if any) at the chosen level. Click on this for the stack as a whole and you should see the stack script window open. If you click on the top left icon in this window (called ‘toggle left panel’) it will also show a list of all your handlers.
Type in your ‘on idle’ handler and hopefully it will work.
Remember that the new field object is now a widget, so in your idle script I guess you would add something like:
– name the new field widgets as work and count.
local tWordcount
put the number of words of the text of widget “work” into tWordcount
set the text of widget “count” to tWordcount
All the best
1 Like
Yes this “field is a widget” issue is very suboptimal. You have to get and set the text property rather than put into/after etc. The syntax parser is being upgraded, so you will soon be able to refer to these widgets as “fields” and do all the things you can do with the Classic field. Same for buttons and all the others, the old syntax will come back RSN. In the mean time just remember they are widgets and you should be ok.
1 Like
Thanks, both, for your pointers. I am really (really!) looking forward to being able to address ‘Create-native’ field widgets as regular fields. I see now how I could work around the current limits, but it is very encouraging to know things will be expanding to include a more traditionally LiveCode-like, natural language-based way of working.
Is there anything available to read that would help me grok the practical difference that being a widget brings? Remembering what’s a widget is fine, but I’m not familiar with dealing with those – it appears I’ve gone for many years without tackling this sort of thing in any serious way.
The first thing to remember is to say “widget” rather than “button” or “field” for the moment.
Beyond that, the main differences are with fields. With most LC objects you can get or set a property. So for example, you can set the rect of a button to a value. You can’t set item 4 of the rect of a button, you have to set the entire property. With fields, you can use chunks to put things before/after/into a word or line etc. With widgets, the text property has to be set as if it was any other object property, so all in one go. This is all going away shortly but hopefully that clarifies the main (temporary) difference at this stage.
Thanks for this, it does help reassure me somewhat. Although the current state of things leaves me effectively like a slightly lost newbie, which is unfortunately very off-putting.
You mention these things being ‘at the moment’ and ‘temporary’ which is great to hear! Is there any roadmap or schedule that could be shared regarding this?
Kevin - great to see your post about the fact that the syntax will be updated so that we can treat the new field widget just like the classic fields. I just created a small stack with LiveCode Create in Classic mode and ran into this situation. And I was just thinking - how many thousands of places in my FmPro Migrator application where I would be reading/writing to fields - where I might have to manually change to the widget syntax. So I look forward to this change when it is released.
1 Like