Stu's test review software learing experience.

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

marielle
Livecode Opensource Backer
Livecode Opensource Backer

Post by marielle » Fri Jan 26, 2007 2:44 pm

Hi Stu,

What is coming next?

Image
Last edited by marielle on Fri Jan 26, 2007 2:52 pm, edited 1 time in total.

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5147
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Fri Jan 26, 2007 2:51 pm

That's a nice positive gesture, Marielle! Thanks for making me smile :-)

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

marielle
Livecode Opensource Backer
Livecode Opensource Backer

Post by marielle » Fri Jan 26, 2007 4:10 pm

Mark wrote:Thanks for making me smile :-)
Always happy to help ;-)

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5147
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Fri Jan 26, 2007 4:17 pm

I know. It is much appreciated :-)

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

stuartls
Posts: 49
Joined: Mon Jan 22, 2007 10:59 pm
Contact:

Post by stuartls » Fri Jan 26, 2007 5:06 pm

Well,

Thanks to my programming guidance counselors Mark and Marielle, better known as M&M I have a newfound sence of accomplishment today! Loved the cartoon! It is on my fridge right now. I had to tweek the line of code. This is what it currently looks like.

on mouseUp
put the hilitedbutton of group "Quest1radio" of card 1 into tResult
if tResult = 4 then add 1 to field "right"
else add 1 to field "wrong"
end mouseUp

I had originally had
if tResult = 1015 then add 1 to field "right"

I misread Mark's notes and then discovered that he was trying to say the sequential number of the button, either 1, 2, 3, or 4. So my fault. So the code goes and finds the selected radio button, checks it in a container and I have learned that you don not have to define containers. Rev does it automatically. So it puts the selected button in a box and opens the lid on the box and checks to see if the contents are what they should be. Today I'm going to find out how to record the actuall questions the student got wrong. My goal is to allow the student to be able to print out a list of the actual questions the student got wrong, and possibly have a book reference along with each question so they can look up the question so to speak and "learn" why they got it wrong. Let me play with it for awhile before you throw any code at me!!!! :D But the route i think i am going to go is with an if statement that sends the card # to a container. A specific container for each card. At the start of this project I always thought that I may, in the end of obtaining what I want, have to a database.... just speculation.....

Stu

stuartls
Posts: 49
Joined: Mon Jan 22, 2007 10:59 pm
Contact:

Post by stuartls » Fri Jan 26, 2007 10:41 pm

Now this should be interesting. I've added another statement to my else. It works. Problem was nobody every told me in anything that I read that each statement after the else must go on a separate line. This is what I have.

on mouseUp
put the hilitedbutton of group "Quest1radio" of card 1 into tResult
if tResult = 4 then add 1 to field "right"
else
add 1 to field "wrong"
put "Question 1" after field "WrongQuestions"
end if

I realize I can put the question # into a container or a field on another card. That is what i want to do. Have a card that has all the wrong questions on it. If the student went to the card it would have something like this.

Question 1
What is the definition of real estate.

Question 2
What is the definition of property.

Then they could print out the wrong questions. I have to figure out how to put all this on a card and format it.

Stu

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5147
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Sat Jan 27, 2007 12:42 am

Hi Stu,

have you condered using a repeat loop to check the answers to the questions on each card?

Code: Select all

on collectAnswers
  -- don't check last card
  repeat with x = 1 to (number of card -1)
    put the fld "Question" of cd x & tab & the hilitedButton of grp "Quest1Radio" & cr after myList
  end repeat
  put myList into fld "A table field"
end collectAnswers
I didn't test this and you might want to use a slightly different approach, but I hope this gives you an idea on how to tackle this, if you hadn't thought of this yet.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

stuartls
Posts: 49
Joined: Mon Jan 22, 2007 10:59 pm
Contact:

Post by stuartls » Sat Jan 27, 2007 12:58 am

Now THAT rocks! I should have thought of that because it only has so many lines of code verses, what, maybe 200 lines of code for all 200 cards? I'll try it. One thing I am puzzled on is the final "wrong answer" card that will have the question number, the test question, and the book page number to look at the answer. Trying to format that in order to make it printable. I have taken your advice and am going to print out the users manual. All 235 pages of it. I have to run to Wal-Mart to get a new printer cart. In following your advice on further review that is when I figured out what "Put into" and "put in", well the differences. Meaning the online glossary isn't toooooooooo awfully bad. It does have some helpful information!!! I appreciate the "loop and counter" path!!!!

Stu

stuartls
Posts: 49
Joined: Mon Jan 22, 2007 10:59 pm
Contact:

Post by stuartls » Sat Jan 27, 2007 1:10 am

Mark,

In my learning process that is why I tend to do things in "long hand" so to speak. Its kind of like, let me make it work then take a look at the complete structure and think of how to save time and code. It is usually the thought process of peeps like me just learning! I thank you for the direction! Guess that is the thing I like about you and Marielle. You guys tend to throw a seed, in your advice, and then watch to see what happens, if it will grow. Just a way of saying thanks to you both from my end.

Stu

stuartls
Posts: 49
Joined: Mon Jan 22, 2007 10:59 pm
Contact:

Post by stuartls » Sun Jan 28, 2007 2:44 am

If I send a "Question number" and an actual "Question" to a card do I want to format it before it gets there, or have the page format it. Unsure which way to look. This is what I would like to do. Send this to a card, which will be printable...

Question 1
What is the definition of real estate?

So do I format the script that sends the message, or format the card that received it.

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5147
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Sun Jan 28, 2007 9:41 am

Hi Stuart,

If you want to format text before printing it, there are severalways to do so.

You can set the text properties of field (font, size, style) and if you execute a line similar to

put "This is my text" into fld "Example"

The entire phrase "This is my text" will be formatted according to the text properties of field "Example".

After putting the text into a field, you can still format parts of the text, regardless of the text properties of the field:

set the textStyle of word 3 of fld "Example" to "bold"
set the textSize of word 3 of fld "Example" to 18


I assume you have one script that collects the questions and puts them into a field on another card. I would use the same script to format the text.

However, if there are scripts in many different places that put the text into a field on a different card and if you display the card before printing the collected questions, you might want to include syntax to format the text in the preOpenCard handler of that card.

Maybe it is even a good idea to collect the questions in the same preOpenCard handler, because that would make your code more transparent than doing things in different places. If you have very many questions, you might show a message, saying that text is being prepared for printing, and a progress bar.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

stuartls
Posts: 49
Joined: Mon Jan 22, 2007 10:59 pm
Contact:

Post by stuartls » Sun Jan 28, 2007 8:05 pm

Mark,

I did find those commands to set the style, font, and so forth of text and used them. I practiced using them to understand how they work, which isn't to complicated. I'm trying to determine at present how to only put something on one line and insert blank lines. For example I want the list of wrong questions to look like this

Question 1
What is the definition of real estate?
See page 234

Question 2
What is the meaning of real estate?
See page 467

I can underline Question 1, Question 2, and so forth, but how to put them on their own line is puzzling to me.

Almost wish there was a "goto next line" or set "Question 2" on next line. lol

Stu, but I'll find it!

stuartls
Posts: 49
Joined: Mon Jan 22, 2007 10:59 pm
Contact:

Post by stuartls » Sun Jan 28, 2007 8:46 pm

I found it. The put return does it.

Stu

stuartls
Posts: 49
Joined: Mon Jan 22, 2007 10:59 pm
Contact:

Post by stuartls » Sun Jan 28, 2007 9:46 pm

Here is a question for you! If I put text into a field, call it "QuestionNumber" and I set the fonts of that field to underline and maybe a size of 20. I use a put command to basically take the text that is in "QuestionNumber" and place it into "WrongQuestions". How do I get the earlier fonts of field "QuestionNumber" to go with the text. AND not apply to the next field that I put into "QuestionNumber"?? Meaning each field that I put into "QuestionNumber" having the fonts of the particular field I took it from? Jeepers I hope I made some sence!!!

Stu

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5147
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Mon Jan 29, 2007 10:35 am

Hi Stu,

I am not completely sure that I understand the problem, but I'll try. Btw, sorry about your previous question, for which I didn't find the time to reply.

You need to know that text and fields both have font and style properties. If you use the menu or a script to set the style of a text, e.g.

set the textFont of char 1 to -1 of fld 1 to "Arial"

the htmlText and rtfText properties include the font Arial. If you set the textFont of a field, e.g.

set the textFont of fld 1 to "Arial"

the font of the text itself remains unchanged.

If you are concatenating text from different fields while the text itself has style properties, you can use the htmlText:

set the htmlText of fld 3 to (the htmlText of fld 1 & the htmlText of fld 2)

But if you concatenate plain text while you still want to preserve the style properties of the field, you need to do something slightly more complicated.

put number of lines of fld 3 into myOldLines
put fld 1 after fld 3
set the textFont of line myOldLines+1 to -1 of fld 3 to the textFont of fld 1
-- continue for textSize and textStyle
put number of lines of fld 3 into myOldLines
put fld 2 after fld 3
set the textFont of line myOldLines+1 to -1 of fld 3 to the textFont of fld 2
-- continue...

Of course, if you have many fields, you could use a repeat loop.

I hope this helps.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”