Code for a wizard

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
montymay
Posts: 145
Joined: Thu Jul 18, 2013 5:23 am

Code for a wizard

Post by montymay » Fri Nov 30, 2018 4:51 pm

In my application I want to use the wizard technique in guiding the users in the process of creating a footnote for any given statement in a unlocked text field. The plan is for the user to click a button that opens a substack, which is the wizard. The first card of the wizard tells the user to click at the location where the footnote reference should be. A selectionChanged handler in the field captures the location and creates a custom property of the field that the wizard can access ("cSelectedChunk" in the code snippet).

Code: Select all

on mouseUp
     open stack "footnoteMaker" as modeless --code must pause here until the user clicks
	put the cSelectedChunk of fld "field" into tSelectedChunk
	. . .
	
However, as commented above, the script needs to pause after the substack "footnoteMaker" opens so that the user can click in the field and the selectionChanged handler can be triggered. However, (correct me if I'm wrong here), making the substack modeless doesn't pause the script. Making it modal or a palette blocks interaction with the field. I see no "pause" command in the dictionary. Thank you for your suggestions in pausing the script or any other solution.

Monty

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9359
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Code for a wizard

Post by richmond62 » Fri Nov 30, 2018 5:17 pm

One way to get round the lack of a 'pause' command might be to have
two halves of your script in mouseDown and mouseUp.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9648
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Code for a wizard

Post by dunbarx » Fri Nov 30, 2018 8:49 pm

I am with Richmond.

Break into two separate processes, each triggered by its own message. Timing and navigation become moot.

It is somehow satisfying to pack such a thing into a single construct, but is usually much simpler and more robust to deal with them separately.

Craig Newman

montymay
Posts: 145
Joined: Thu Jul 18, 2013 5:23 am

Re: Code for a wizard

Post by montymay » Sat Dec 01, 2018 2:37 am

Thank so much for your replies, which suggests what should have been obvious to me. But rather than using separate mouseup and mousedown handlers, it seems that I can just open the wizard substack with an external button, let the user click in the field to set the location of the footnote reference, and then put the subsequent code in the button on the first card of the wizard that takes the user to the second card.

It's always a relief to overcome coding roadblocks with the help of this forum and go forward from there.

Monty

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”