custom answer boxes

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: heatherlaine, Klaus, FourthWorld, kevinmiller

Post Reply
Da_Elf
Posts: 305
Joined: Sun Apr 27, 2014 2:45 am

custom answer boxes

Post by Da_Elf » Sun Jan 07, 2018 8:28 pm

Im not sure if you can customise the ones that are built in or if i would have to code my own answer pop up. I know i can design it to be a warning with an OK and Cancel but it would also be nice to have a checkbox that says "Don't show this warning again". I assume im going to have to create my own thing.

bogs
Posts: 1912
Joined: Sat Feb 25, 2017 10:45 pm

Re: custom answer boxes

Post by bogs » Sun Jan 07, 2018 8:48 pm

Well, that was how I went making this -
Image
but from what I understand you should be able to customize the ask and answer dialogs pretty far. I haven't done it yet, but dialogData is a global that should be returning the information you ask for is what I got out of my reading of this page.

I doubt something like your talking about is going to be all that complicated either road.
Image

Da_Elf
Posts: 305
Joined: Sun Apr 27, 2014 2:45 am

Re: custom answer boxes

Post by Da_Elf » Sun Jan 07, 2018 10:34 pm

Holy crap thats so awesome. This would be exactly what i need and this opens so many more possibilities. wow. thanks.

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

Re: custom answer boxes

Post by dunbarx » Sun Jan 07, 2018 10:36 pm

It is possible to modify the "text" portion of these dialogs, but I do not know if it is possible to modify the controls that are pre-packaged with them.

I would roll your own, as you suspected. That is easy, likely easier that modifying the global that Bogs mentioned. And then you can change its size, color, whatever. Heck, you could even open a DG of type form, but I am hoping that is vastly overkill.

Craig Newman

Newbie4
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 271
Joined: Sun Apr 15, 2012 1:17 am
Location: USA
Contact:

Re: custom answer boxes

Post by Newbie4 » Sun Jan 07, 2018 10:54 pm

It is easier to create your own "dialog". It just takes a substack that you set as "modal". It can replace your "ask" or "answer" dialog.
Modal - for blocking other actions
A modal dialog box is a window/stack that blocks all other actions as long as the stack is displayed. An example is "Ask" and "Answer" dialog boxes. You can not do anything else as long as it is open.
1. Create a substack and design your dialog box on it
2. On your original stack

Code: Select all

modal stack "Pop-up" 
or
go stack "Pop-up" as modal
That's it

For a simple example see here: https://sites.google.com/a/pgcps.org/li ... s_palettes
Cyril Pruszko
https://sites.google.com/a/pgcps.org/livecode/
https://sites.google.com/a/setonhs.org/app-and-game-workshop/home
https://learntolivecode.com/

bogs
Posts: 1912
Joined: Sat Feb 25, 2017 10:45 pm

Re: custom answer boxes

Post by bogs » Sun Jan 07, 2018 11:59 pm

Da_Elf wrote:
Sun Jan 07, 2018 10:34 pm
Holy crap thats so awesome. This would be exactly what i need and this opens so many more possibilities. wow. thanks.
My pleasure, glad to be able to help :)

As the others mentioned, rolling your own isn't overly complicated either, in fact it was scary easy.

I am curious as I've seen differing opinions as to the advantage of opening it as 'modal' vs. 'modeless'. Modal is blocking right? In other words, you can't interact with any other windows until the modal one is dismissed?

And modeless would allow interaction with things even when the dialog is up? Curious as to what others think is better and why.

BTW, good explanations on the page linked in newbie's post.
Image

Da_Elf
Posts: 305
Joined: Sun Apr 27, 2014 2:45 am

Re: custom answer boxes

Post by Da_Elf » Mon Jan 08, 2018 1:13 am

using modal was what i needed so it would block everything else while waiting for a reply.
seeing as i was creating one of those pesky warning boxes that say Ok or Cancel i wanted a check mark too to allow my to say "Dont show this warning again". This allows me to perfectly send back an ok or cancel along with the highlight of the checkbox

MaxV
Posts: 1506
Joined: Tue May 28, 2013 2:20 pm
Location: Italy
Contact:

Re: custom answer boxes

Post by MaxV » Mon Jan 08, 2018 6:16 pm

The text of answer or ask is intepreted as htmlText, so you can use HTML to produce cool effect.
For example:

Code: Select all

answer error "<b>Noooo!</b> <br>You shouldn't have clicked that button..."
Nooo.png
Nooo.png (6.18 KiB) Viewed 570 times
Livecode Wiki: http://livecode.wikia.com
My blog: http://livecodeitalia.blogspot.it
To post code use this: http://tinyurl.com/ogp6d5w

bogs
Posts: 1912
Joined: Sat Feb 25, 2017 10:45 pm

Re: custom answer boxes

Post by bogs » Mon Jan 08, 2018 9:19 pm

Oh that is too cool Max 8)
Image
Image

Newbie4
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 271
Joined: Sun Apr 15, 2012 1:17 am
Location: USA
Contact:

Re: custom answer boxes

Post by Newbie4 » Mon Jan 08, 2018 9:58 pm

You can also modify fields using the htmlText property.
See #2 on this webpage - https://sites.google.com/a/pgcps.org/li ... euser/html

but the most common use of it is for showing HTML content without the HTML tags.
See #3 on the same webpage - https://sites.google.com/a/pgcps.org/li ... euser/html
Cyril Pruszko
https://sites.google.com/a/pgcps.org/livecode/
https://sites.google.com/a/setonhs.org/app-and-game-workshop/home
https://learntolivecode.com/

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”