button makes form open
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
button makes form open
I want to create an app that tracks my plants in my garden. I want to open the app select a button called new plant and have a window open that allows me to enter the new plants info and track it through its growth and chart the data. I have created a mainstack with cards representing my start card and my new plant card. How do i tell the button to open the new plant card?
-
- VIP Livecode Opensource Backer
- Posts: 858
- Joined: Wed Jun 24, 2009 1:17 pm
- Contact:
Re: button makes form open
Hi Ledrac and welcome to the forum 
Try this in the script of your button:

Try this in the script of your button:
Code: Select all
on mouseup
go card "cdNewPlant"
end mouseup
"...this is not the code you are looking for..."
Re: button makes form open
Hi ledrac,
you might want to take a look at these stacks, great learning resources:
http://www.hyperactivesw.com/revscriptc ... ences.html
Best
Klaus
you might want to take a look at these stacks, great learning resources:
http://www.hyperactivesw.com/revscriptc ... ences.html
Best
Klaus
Re: button makes form open
I tried this code from the "Stock" lesson
on newEntry
## Add a new card
## This will create a new card with the controls group on it
create card
## The long name is a unique identifier
put the long name of it into tNewCard
## Put the initial text into the fields
send "resetControls" to group "controls" of tNewCard
## Go to the new card using a visual effect
visual effect push left
go to tNewCard
## Put the cursor in the name field
focus on field "name" of group "controls" of tNewCard
select after field "name" of group "controls" of tNewCard
end newEntry
How does the script know what new card to make? I don't want a copy of the card the button was on. I want it to use a blank form for each new plant.
on newEntry
## Add a new card
## This will create a new card with the controls group on it
create card
## The long name is a unique identifier
put the long name of it into tNewCard
## Put the initial text into the fields
send "resetControls" to group "controls" of tNewCard
## Go to the new card using a visual effect
visual effect push left
go to tNewCard
## Put the cursor in the name field
focus on field "name" of group "controls" of tNewCard
select after field "name" of group "controls" of tNewCard
end newEntry
How does the script know what new card to make? I don't want a copy of the card the button was on. I want it to use a blank form for each new plant.
Re: button makes form open
Hi ledrac,
Take a look at "template" in the dictionary.
Specifically templateCard
Simon
Take a look at "template" in the dictionary.
Specifically templateCard
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: button makes form open
Thanks Simon. I am sorry for the silly questions but could you give me an example of how I would use the Template card in my app?
Re: button makes form open
Hi ledrac,
Not a silly question.
But, you should study the link Klaus posted and;
http://lessons.runrev.com/
In liveCode there are a dozen different ways to accomplish what you are trying to do and because of what it is you want to do I wouldn't recommend creating a new card.
Your project is great for learning liveCode but you slightly jumped in at the deep end. I guess one of the things I say quite often is that a standalone cannot save itself. In the IDE (where you write the scripts) sure, but not when you make a app (.exe,app).
No application ever saves itself, what it does is writes reminders in a separate file and reads that file every time it opens. Make sense? Every time you seem to have changed an app (like added bookmarks to a browser or changed a background color, setup an email account) it is written to a separate file.
Can you get your head around that? If it were me there would only ever be 2 cards in your stack (maybe 3).
Ugh;
http://lessons.runrev.com/s/lessons/m/4 ... ng-to-file
Not very helpful.
Study a bit and ask when you get stuck.
Simon
Not a silly question.
But, you should study the link Klaus posted and;
http://lessons.runrev.com/
In liveCode there are a dozen different ways to accomplish what you are trying to do and because of what it is you want to do I wouldn't recommend creating a new card.
Your project is great for learning liveCode but you slightly jumped in at the deep end. I guess one of the things I say quite often is that a standalone cannot save itself. In the IDE (where you write the scripts) sure, but not when you make a app (.exe,app).
No application ever saves itself, what it does is writes reminders in a separate file and reads that file every time it opens. Make sense? Every time you seem to have changed an app (like added bookmarks to a browser or changed a background color, setup an email account) it is written to a separate file.
Can you get your head around that? If it were me there would only ever be 2 cards in your stack (maybe 3).
Ugh;
http://lessons.runrev.com/s/lessons/m/4 ... ng-to-file
Not very helpful.
Study a bit and ask when you get stuck.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: button makes form open
Thanks, it does make sense. I will study
Re: button makes form open
Hi ledrac,
I was so disappointing with that lesson I've made a stack for you:
This stack shows you the basics of saving/loading a preference file and binary data to a specific folder on your drive.
Most of the scripts are in the buttons.
It might not be commented enough but I'm lazy.
Be sure to look at the preference.txt file that is save to see how easy it is. No need for 100's of cards just 100's of lines in a single text file.
I left out editing of the text description, something you may want to do. I leave it up to you to figure that part out but gCounter has everything to do with it.
Simon
Edit: I will not say that the methods I use are the "Best" just another way.
I was so disappointing with that lesson I've made a stack for you:
This stack shows you the basics of saving/loading a preference file and binary data to a specific folder on your drive.
Most of the scripts are in the buttons.
It might not be commented enough but I'm lazy.
Be sure to look at the preference.txt file that is save to see how easy it is. No need for 100's of cards just 100's of lines in a single text file.
I left out editing of the text description, something you may want to do. I leave it up to you to figure that part out but gCounter has everything to do with it.

Simon
Edit: I will not say that the methods I use are the "Best" just another way.
- Attachments
-
- myPlants.zip
- LC 6.5 updated April 9 2014
- (2.21 KiB) Downloaded 166 times
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!