Lesson 1 questions

Moderators: LCNeil, heatherlaine, kevinmiller, elanorb

Post Reply
MitchSF
Posts: 5
Joined: Tue Mar 11, 2014 7:10 pm

Lesson 1 questions

Post by MitchSF » Fri Mar 14, 2014 2:35 pm

All of the issues I have so far are related to the previous release of MobGui used in the lesson, and my preference to use the latest version. Here they are in no particular order:

1. Is it necessary to use a tab bar behind the option button group? If so, why?

2. The new MobGui NavBar does not appear to have a "title" property. I used a MobGui button on top and the mgText property to set the title, but I guess I could have used a livecode label rather than a MobGui button. Is it preferable to use MobGui objects where possible? Why is NavBar even necessary?

The next few questions are related to getting the button name to the title on NavBar.

3. The button code in the lesson is completely different from that in the new MobGui option button. There is no touchStart event, but there is an event called preOpenControl, which already contains the statement, "pass preOpenControl." But this even never seems to be executed. I tested it with a breakpoint.

From my understanding, which is obviously wrong, preOpenControl should contain the name of the button, and "pass preOpenControl" should pass it to the tab control object where "set the mgText of group "title" to preOpenControl" should update the title. It appears that preopencontrol does not exist in the variables list.
I tried adding a touchStart event but that didn't work.

In short, I'm lost at this point!

Thanks in advance for the help.
Mitch

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: Lesson 1 questions

Post by LCNeil » Fri Mar 14, 2014 4:24 pm

Hi Mitch,

Welcome to the forum,

The coding school course focuses on using the older revision of the mobGui plugin. This is due to mobGui being recently updated after the sessions had been recorded. It may be slightly more difficult to following along using the new version.

It is not necessary to use the tab bar but if this was not present then the transparent state of the tab bar buttons could give a slightly off visual look when the buttons are not active.

The nav bar is the present to give the user of your application a visual representation of where you are. It is not a requirement and it will depend on the design of any application you create, whether one is present or not.

Using LiveCode or mobGui elements is entirely a user based choice. The advantage of mobGui elements is that they are designed with a mobile esque look and feel.

The on preOpenControl section of a button is created automatically by the new version of mobGui and you don’t really want to be handling any of your scripts in there. When you pass something in LiveCOde you are not passing scripts to a specific object, but letting that message progress along the LiveCode message path.

What you need to do is add the “"set the mgText of group "title” to the auto populate mouseUp handler of the mobGui button. This will allow this script to executer when you press the button, and assign the title group text accordingly.

Kind Regards,


Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
——

MitchSF
Posts: 5
Joined: Tue Mar 11, 2014 7:10 pm

Re: Lesson 1 questions

Post by MitchSF » Fri Mar 14, 2014 6:46 pm

Hi Neil,

Thanks for your reply.

I was able to set the title using a constant, but I'm not sure what variable contains the button name. Using the MobGui documentation, I tried:

set the mgText of group "title" to the mgOptionText of me

That just cleared the title field, so at this point I guess I just need the correct variable.

And my final question - where can I find documentation on all events that a given object will respond to, such as "on mouseUp", and the properties for the objects? I would not have known to use "on mouseUp" had you not mentioned it.

I guess you're right about using the previous version of MobGui for the class. I'd just rather use the latest if at all possible, but it's much more difficult for a beginner.

Regards,
Mitch

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: Lesson 1 questions

Post by LCNeil » Sat Mar 15, 2014 2:22 pm

Hi Mitch,

The title button is likely to be turning blank when using mgOptionText, as this is used when you have multiple option buttons that have been turned in to a LiveCode group. You then assign that script to the group and the text will change as expected. Please see the attached example stack that shows this.
mitch.livecode.zip
(3.26 KiB) Downloaded 195 times
For all events that a given object responds too, you will be able to use the LiveCode dictionary for this purpose. This can be accessed from within the LiveCode IDE via the "Dictionary" toolbar tab. When the dictionary is opened, you can then select a specific object (e.g. button) from the left hand side object menu and filter the results by "message"

I hope this gives you some leads.

Kind Regards,


Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
——

MitchSF
Posts: 5
Joined: Tue Mar 11, 2014 7:10 pm

Re: Lesson 1 questions

Post by MitchSF » Sat Mar 15, 2014 5:06 pm

Thanks again, Neil. Now I understand, and I was able to complete lesson 1. I think I'll try lesson 2 with the new MobGui before going back.

Mitch

N1073
Posts: 2
Joined: Mon Jan 27, 2014 3:55 pm

Re: Lesson 1 questions

Post by N1073 » Sun Mar 16, 2014 12:39 am

Hi! Thanks for your reply, I had the same doubts and it cleared the up.
One question: Can I do the same thing (showing the option name on the Navbar) with Icon Buttons? Been trying to figure it out without any luck...

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: Lesson 1 questions

Post by LCNeil » Mon Mar 17, 2014 11:56 am

Hi N1073,

Yes it is possible to use icon, but the easiest way to do this would be via a LiveCode button. You can then easily assign an image as an icon to the button. The images can be imported into the card you are working on or a resource card/substack.

You would then use a switch statement along with the mgOptionText to assign an icon-

Code: Select all

on mouseUp
   switch the mgOptionText of me
      case "test1"
         set the icon of button "icon" to 1035
         break
      case "test2"
         set the icon of button "icon" to 1036
         break
      case "test3"
         set the icon of button "icon" to 1034
         break
   end switch
end mouseUp
I have a attached a sample stack showing this in action
iconset.livecode.zip
(10.32 KiB) Downloaded 198 times
Kind Regards,


Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
——

N1073
Posts: 2
Joined: Mon Jan 27, 2014 3:55 pm

Re: Lesson 1 questions

Post by N1073 » Mon Mar 17, 2014 9:56 pm

Thanks a lot, Neil!

Best Regards,

Nuno

Post Reply

Return to “idea2app and Coding School”