go forward/backward in cards

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
docHerman
Posts: 29
Joined: Sat Mar 24, 2012 9:20 pm

go forward/backward in cards

Post by docHerman » Mon Apr 09, 2012 10:12 am

Dear all

I try to improve my App, hopefully one day the App store accepts it. In the meanwhile I have some questions.
I made a scrolling list field: now how do I program that an other card is selected when a bar is touched/doubleclicked? And how can I make specific headers (like 'algemeen') grey & bigger?
I would prefer that the cards would be pushed to the left/right.

Thank you so much,
I like this product & forum a lot,

herman
Attachments
Schermafbeelding 2012-04-09 om 11.04.13.png
scrolling field

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: go forward/backward in cards

Post by shaosean » Mon Apr 09, 2012 11:17 am

I made a scrolling list field: now how do I program that an other card is selected when a bar is touched/doubleclicked?
easiest way is to name the card the same as the line of text, but if you are using non-ascii characters you will run in to an issue (personally i take the text and make a hash and use the hash in the same manner)..

mouseDoubleUp message -- handles the double clicking
go command -- handles the moving to another card
I would prefer that the cards would be pushed to the left/right.
visual effect command -- handles the pushing left/right visual effect
And how can I make specific headers (like 'algemeen') grey & bigger?
with the built-in listbox, either very hard or not at all.. might be better off looking in to using the DataGrid feature
http://lessons.runrev.com/m/datagrid

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: go forward/backward in cards

Post by shaosean » Mon Apr 09, 2012 11:21 am

Maybe look at MobGUI and use native-looking iOS listboxes

Klaus
Posts: 14196
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: go forward/backward in cards

Post by Klaus » Mon Apr 09, 2012 12:30 pm

Dag Herman,

welcome to the forum! :D

Please take a look at these stacks:
http://www.runrev.com/developers/lesson ... nferences/

They are not iOS related, but will give you a good insight about all the cool aspects of LiveCode,
which you can of course also use on iOS! :)


Best & Groetjes

Klaus

docHerman
Posts: 29
Joined: Sat Mar 24, 2012 9:20 pm

Re: go forward/backward in cards

Post by docHerman » Mon Apr 09, 2012 4:17 pm

Thank you all for your kind words.
Maybe my question was not cleaar enough, I am sorry for that.
I try to say it more clear now:

Can someone please help me with the Code?
I just want to select a line in the Scrolling List Field and want to go to an other card.

I hope I do not sound unkind, that is not my intention. I apologize for that in advance :oops:
Once again, thanx for your help

Herman

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10320
Joined: Wed May 06, 2009 2:28 pm

Re: go forward/backward in cards

Post by dunbarx » Mon Apr 09, 2012 4:31 pm

Hi.

In a list field, trap the "mouseUp" message, perhaps like this:

Code: Select all

on  mouseUp
      put word 2 of the clickline
end mouseUp
So you see that the line number appears in the message box. I don't know how you want to navigate, but if you wrote
on mouseUp
go card word 2 of the clickline
end mouseUp
you would go to the card number that corresponds to the line number in the list field.

Maybe you have card names in that list? in that case:

Code: Select all

on  mouseUp
      go card the clickText
end mouseUp
I hope these examples help. We do not know how your list is composed, or how you want to map the lines in that list to the cards you want to go to. Write back if I missed something. Also read in the dictionary about the terms I used above, like "clickLine" and "clickText"

Craig Newman

docHerman
Posts: 29
Joined: Sat Mar 24, 2012 9:20 pm

Re: go forward/backward in cards

Post by docHerman » Mon Apr 09, 2012 6:49 pm

Hi Craig

I didn't manage, unfortnately.
I put a new attachement, maybe this makes it more clear.
My first attachement is the scrolling field of the S03_iphonesubstackNL-card: when I select 'inleiding', I hope the card 'inleiding' will be openend.

I tried:

Code: Select all

on mouseUp
go card word 1 of the clickline
end mouseUp
but I didn't succeed.

Waiting for your kin help,
regards, Herman
Attachments
Schermafbeelding 2012-04-09 om 19.43.29.png
Schermafbeelding 2012-04-09 om 19.43.29.png (28.79 KiB) Viewed 7608 times

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

Re: go forward/backward in cards

Post by sturgis » Mon Apr 09, 2012 7:00 pm

Does it work if you change it to

Code: Select all

go card (word 1 of the clickline)
With the parens it will do the evaluation of "word 1 of the clickline" first so that go card isn't trying to go card 'word'

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: go forward/backward in cards

Post by mwieder » Mon Apr 09, 2012 7:15 pm

This should make it a bit clearer what's going on:

Code: Select all

on mouseUp
  put the clickline into tCard
  -- display what's in "the clickline"
  put "the clickline" && the clickline into msg
  -- display what's in "the clicktext"
  put "the clicktext=" && the clicktext after msg
end mouseUp

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

Re: go forward/backward in cards

Post by sturgis » Mon Apr 09, 2012 7:18 pm

*smacks self on forehead* clicktext. Shoulda caught that.

docHerman
Posts: 29
Joined: Sat Mar 24, 2012 9:20 pm

Re: go forward/backward in cards

Post by docHerman » Mon Apr 09, 2012 7:49 pm

@mwieder, I tried your advice and attached the answer
@sturgis, I do not understand what you mean.

H
Attachments
Schermafbeelding 2012-04-09 om 20.46.13.png

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

Re: go forward/backward in cards

Post by sturgis » Mon Apr 09, 2012 8:04 pm

Ignore my first answer, apparently my brain was in left field.

As marks code indicates "the clickline" is a description of the chunk of text that has been clicked. IE line 3 of field 2 So using "word 1 of the clickline" will always try to go to a card named line which doesn't exist. (if you try to go card "whateverCardDoesntExist" and then see whats in "the result" it will say "no such card")

The clicktext on the other hand actually contains the text that was clicked.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: go forward/backward in cards

Post by mwieder » Mon Apr 09, 2012 8:36 pm

OK, several things here.

First of all, my code example was just so you could see the difference between "the clickline" and "the clicktext", and as sturgis points out, "the clickline" is just an indication of the line number, not the actual text. So go ahead and delete the lines of text I had you add.

(and I should have added "& cr " before the "after msg" to separate the lines) :oops:

Second, you're trying to match *some* of the text in the line rather than the whole text. "waarom" doesn't match "waarom deze App? >", for example. There are a few ways to deal with that. If you're sure that the text you're searching for is unique (isn't in more than one line) then you can say

Code: Select all

if "waarom" is in the clicktext then
As an alternative you can match the entire line

Code: Select all

if the clicktext is "waarom deze App?" then
Third, notice that the ">" indicator is part of the clicktext. If you're going to match the line exactly then you need to include that as well as all the space before it, or the second approach above will fail.

Code: Select all

if the clicktext is "inleiding         >" then

docHerman
Posts: 29
Joined: Sat Mar 24, 2012 9:20 pm

Re: go forward/backward in cards

Post by docHerman » Tue Apr 10, 2012 10:37 am

Yes, this works! Thanx all, docH

Post Reply