novice first of many hurdles, bugs

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
nutsnvolks
Posts: 2
Joined: Mon Jun 04, 2012 9:18 pm

novice first of many hurdles, bugs

Post by nutsnvolks » Mon Jun 04, 2012 9:28 pm

Hi there, i have just installed livecode and am very slowly trying to learn it, i am a complete novice from a very differant background so please be patient with me!

I have been trying to do a small and very simple bit of coding based on what i am learning in the tutorials, however, in the first one it says that you can control the buttons from the stack code, rather than the button code itself!! That was fine and quite obvious ho to do it based on the way queries are sent from objects to cards to stacks ect, however when using multiple buttons on the same card that do very similar things i was a bit confused so tried to make a mockup to get it working, i thought i had it untill i noticed that if i click on the app somewhere other than a button i get a bug at line 2 :(

this is my main stack code....
on mouseup
put the label of target into thiskey
put "jenny has a " & thiskey & " nose" into field 1
end mouseup


on gonext
go to next card
end gonext

on goback
go to previous card
end goback
ok the last bit was just other bits i was trying, basically, i have 2 buttons, one label is big the other is small it then displays the sentance in the text field, but like i say, if i click on the running program somewhere other than the buttons it returns debug mode :(
i also have a clear text field button but i coded that directly in the button as it had a very differant job to the ret of the buttons.

hope you dont mind shedding some light on a very very novice question.

cheers
jon

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: novice first of many hurdles, bugs

Post by Dixie » Mon Jun 04, 2012 10:10 pm

Hi Jon...

Welcome to the forum.. Don't worry about asking questions as that is what the forum is for...:-)
From what you want to do there are a number of ways to go about it... but lets assume you have three buttons on a card whose labels are 'big','small' and 'beautiful' respectively... in the script of each button :-

Code: Select all

on mouseUp
   doDescription (the short ID of me)
end mouseUp
In the script of the card

Code: Select all

on doDescription theID
   put "Jenny has a" && the label of button ID theID && "nose." into fld 1
end doDescription
be well

Dixie
Attachments
Jenny's Nose.livecode.zip
(1.1 KiB) Downloaded 158 times

nutsnvolks
Posts: 2
Joined: Mon Jun 04, 2012 9:18 pm

Re: novice first of many hurdles, bugs

Post by nutsnvolks » Mon Jun 04, 2012 10:33 pm

thats great thanks, works a treat :)

Just so i know what im doing, and more importantly why.......

you asked me to add the code to the buttons.....

dodescription - this can be anything that i choose - just another label for this group of buttons i guess!

(the short id of me) - not sure why its in brackets, but this line must be there it seems, i guess its telling it that dodescription is the ID of each button i add this to (ME being the button) ??? i think im about right with that


on the card script (i added to the stack script as i had a couple of cards with similar things on) ............

on dodescription theid - again dodescription is telling it that im refering to the buttons, but why do i need to add THEID i tried without but it doesnt work, so what does theid do, cant find it in dictionary
the rest is self explanatory.

once again thanks for the help, and apologies for dissecting your code, i just feel i need to understand WHY in order to understand how!!

cheers
jon

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: novice first of many hurdles, bugs

Post by sturgis » Tue Jun 05, 2012 12:36 am

The reason it isn't working as you expect is because the card the buttons are on has no label. (cards don't have labels.)

You'll need to check for this in code.

if the first word of the name of the target is "button" then
-- do whatever you wish with the butotn
end if

In fact, when you get popped back to the script editor (debugger) the error message should say something like: blah blah blah (Object does not have this property)

Hope this helps.
nutsnvolks wrote:Hi there, i have just installed livecode and am very slowly trying to learn it, i am a complete novice from a very differant background so please be patient with me!

I have been trying to do a small and very simple bit of coding based on what i am learning in the tutorials, however, in the first one it says that you can control the buttons from the stack code, rather than the button code itself!! That was fine and quite obvious ho to do it based on the way queries are sent from objects to cards to stacks ect, however when using multiple buttons on the same card that do very similar things i was a bit confused so tried to make a mockup to get it working, i thought i had it untill i noticed that if i click on the app somewhere other than a button i get a bug at line 2 :(

this is my main stack code....
on mouseup
put the label of target into thiskey
put "jenny has a " & thiskey & " nose" into field 1
end mouseup


on gonext
go to next card
end gonext

on goback
go to previous card
end goback
ok the last bit was just other bits i was trying, basically, i have 2 buttons, one label is big the other is small it then displays the sentance in the text field, but like i say, if i click on the running program somewhere other than the buttons it returns debug mode :(
i also have a clear text field button but i coded that directly in the button as it had a very differant job to the ret of the buttons.

hope you dont mind shedding some light on a very very novice question.

cheers
jon

Post Reply