Re: I want to turn my Figma Prototype into a program
Posted: Mon Oct 25, 2021 6:00 am
You might also take a look at this: https://livecode.com/extensions/calendar/1-0-0/
Questions and answers about the LiveCode platform.
https://forums.livecode.com/
Avoid that kind of stuff, it'll bite you later, extra hidden controls floating around can get messy, you delete it or rename it and your scripts are screaming "I can't find that thing!"Next button stores this info from the fields to the hidden table field before navigating to "Verify_info"
Code: Select all
on KeepCurrentData
set the cName of card "Meeting_info_card" to line 1 of field "Name" of card "Client_info_card"
set the cLocation of card "Meeting_info_card" to line 1 of field "Location" of card "Client_info_card"
set the cPhone of card "Meeting_info_card" to line 1 of field "Phone" of card "Client_info_card"
set the cEmail of card "Meeting_info_card" to line 1 of field "Email" of card "Client_info_card"
end KeepCurrentDataCode: Select all
function GetCurrentData
put the cName of card "Meeting_info_card" into tName --//t is for 'temp'
put the cLocation of card "Meeting_info_card" tLocation
put the cPhone of card "Meeting_info_card" tPhone
put the cEmail of card "Meeting_info_card" tEmail
return tName, tLocation, tPhone, tEmail
end GetCurrentData
Code: Select all
put GetCurrentData() into currentDataCode: Select all
set itemDelimiter to comma --// or itemDel for short, comma is the default, use "/" for parsing dates
put item 1 of currentData into field "name"
put item 2 of currentData into field "Location"
--etc etcCode: Select all
replace comma with cr in currentDataCode: Select all
local cName ,cLocation ,cPhone ,cEmail Code: Select all
on MouseDown
KeepCurrentData
end MouseDown
on KeyUp
KeepCurrentData
end KeyUpCode: Select all
on KeepCurrentData
put line 1 of field "Name" of card "Client_info_card" into cName
put line 1 of field "Location" of card "Client_info_card" into cLocation
put line 1 of field "Phone" of card "Client_info_card" into cPhone
put line 1 of field "Email" of card "Client_info_card" into cEmail
end KeepCurrentDataCode: Select all
on OpenCard
put List_Of_Current_Info() into field "ContactInfo"
end OpenCardCode: Select all
on List_Of_Current_Info
return (cName & cr & cLocation & cr & cPhone & cr & cEmail)
end List_Of_Current_InfoCode: Select all
on openCard
LayoutGUI
end openCard
on LayoutGUI
lock screen --// hide this activity from the user
put 4 into tSpread
put 10 into tLeft
set the topLeft of field "NameLabel" to tLeft,4
set the topLeft of field "Name" to tLeft,bottom of field "NameLabel"
set the topLeft of field "PhoneLabel" to tLeft,bottom of field "Name"+tSpread
set the topLeft of field "Phone" to tLeft,bottom of field of field "phoneLabel"
--etc etc
-- do other stuff
unlock screen
end LayoutGUI
Code: Select all
set the loc of field "whatever" to x,yDevelopment Menu > Plugins > revApplicationOverview i had to go looking for it, there's a fancier one out there somewhere on the "Sample Stacks" you can find in the livecode menu bar thing.Is there a plugin to list all created elements in a stack?
Code: Select all
Is it possible to see more than one card at a time?Code: Select all
on OnionSkinACard otherCard
put the number of controls of card otherCard into N
repeat with i = 1 to N
copy control i of card otherCard to this card
set the lockloc of it to true
set the foregroundcolor of it to 250,250,255
set the backgroundcolor of it to 250,250,255
set the disabled of it to true
set the name of it to "onion"&i --//maybe
put "and" && the name of it after onionGroup
end repeat
do ("group" && word 2 to -1 of onionGroup)
set the name of the last group to "delete_me_when_done"
set the layer of the last group to bottom
set the lockloc of the last group to true
end OnionSkinACard
Code: Select all
on Onion otherCard
if otherCard is empty then put the number of this card+1 into otherCard
if char 1 of otherCard is "-" then put the number of this card +otherCard into otherCard ---//"-1" onionskin the previous card
put the number of controls of card otherCard into N
repeat with i = 1 to N
put the rect of control i of card otherCard into tRect
put the short name of control i of card otherCard into tName
create graphic
set the rect of the last graphic to tRect
set the name of the last graphic to tName
set the showName of the last graphic to true
set the lockloc of the last graphic to true
set the foregroundcolor of the last graphic to 200,200,255
set the lineSize of the last graphic to 2
put "and graphic" && quote & tName & quote after onionGroup
end repeat
do ("group" && word 2 to -1 of onionGroup)
set the name of the last group to "delete_me_when_done"
set the layer of the last group to bottom
set the lockloc of the last group to true
end Onion
Code: Select all
on OnionOff
if exists(group "delete_me_when_done") then delete group "delete_me_when_done"
end OnionOffNope, but you can make one super easyIs there an in-program Notepad or to do list? Would be great to keep that info all in one place with the stack.
Code: Select all
on Notes
palette stack "Notes" --// use 'open' if you want to do development to it
end NotesOn "Client_info_card" the text fields for Name, Company, Phone Number, and Email are blank. They should each read their function until the user adds new info to the field.
? ?read their function
I don't think I meant "read their function," I was trying to say the text field is filled with what info they are requesting. So the field says Name until you type in it and change it to the actual name. I believe arrays are the answer here, but I am so new and pretty easily overwhelmed by programming and its jargon. I think I will spend my set aside programming time learning more about arrays to better explain myself. The solution I am going for would Populate the data field with those text strings (name, company, etc. etc.) when you click new client. Then it would display those strings in the appropriate text field until the user replaced them with the new info.xAction wrote: Mon Oct 25, 2021 7:27 am Oh you said something odd.On "Client_info_card" the text fields for Name, Company, Phone Number, and Email are blank. They should each read their function until the user adds new info to the field.? ?read their function
Fields just sit their doing nothing until the user does something to them. Last thing you'd want for a mobile app is for fields to be constantly doing some processing and chewing the battery life. So the fields either are blank or are given data once by a handler, probably in the openCard message of the card. And that just needs to happen once per record put into the fields, or twice if you have an undo/revert button.
You should have a single handler that plops all the data into all the related fields of a card in one shot.
If you need to retrieve/manipulate complicated data the handler can call a function that does the work and returns some data.
For example ...hmm whats a good example?
Well go back to my first post, there's examples of handlers/functions interacting with custom property arrays to fill the fields.
Code: Select all
on mouseUp
go to card "NEWMEET"
end mouseUp
Well, on that basis I would say "screw arrays", especially as LiveCode gives youI literally have a day's worth of programming knowledge
Code: Select all
put the properties of this card into tArray
put the keys of tArrayCode: Select all
put the controlNames of this cardCode: Select all
put the contactList of this card into tArray
put the keys of tArray
Code: Select all
put tArray["Name"] into tNamesArray
put the keys of tNamesArrayCode: Select all
repeat with i = 1 to number of cards of this stack
go to card i
put cr & field "Name" of card i after tNames
end repeat
put tNamesBecause of a lot of blue-sky thinking.I am not sure why tutorials seem to miss what people will use their products for.
Code: Select all
on OpenField
RefreshUnderFields
end OpenFieldCode: Select all
on storeContactsAsCSV
put "Name,Company,Phone,Email,Meeting Date, Meeting Time, Location, Topic" into tFields
put the number of cards of this stack into N
repeat with i = 2 to n --// 1 is the main screen
repeat for each item F in tFields
put line 1 to -1 of field F of card i into tFieldData
replace cr with "^^" in tFielddata --// need to keep it all on one line
put tFielddata & comma after tDataLine
end repeat
put cr & char 1 to -2 of tDataLine after allData --//dont want trailing comma
end Repeat
--// got al the data? Store it in a custom property
set the ContactDatabase of stack (The mainStack of this stack) to allData
put "file:" & specialFolderPath("Documents") & "/ContactaDatabase.txt" into tFilepath
put allData into URL tFilepath --// a back up text file
end storeContactsAsCSVCode: Select all
on mouseUp
put the clickText into KARD
go to card KARD
end mouseUp