Page 1 of 1

Designing your own modal dialogue box from scratch

Posted: Fri Nov 15, 2013 4:57 pm
by chris25
I saw the tutorial "how do I create a modal dialogue" but that does not look like what I ma after, some searching turns up nothing even on this forum, has the question been asked before? It must have been. I want to design a custom modal dialogue box, with different shape colour feel and look. Logic says surely this can be done, but all I can see is creating a substack and fiddling around there, but this is not the same thing as making your own modal box. Is it possible? If so, is there a tutorial?

Thankyou
chris

Re: Designing your own modal dialogue box from scratch

Posted: Fri Nov 15, 2013 5:27 pm
by FourthWorld
Stacks can be opened in different modes by using the command name that corresponds to that mode. For example, to open a stack as a palette you would use:

Code: Select all

palette "MyStack"
...and to open as a modal dialog:

Code: Select all

modal "MyStack"
Be sure to include a button that will close the stack before testing it, because, being modal, there will be no other way to close it other than quitting LiveCode.

You may also want to see the Dictionary entry for the dialogData global property for a convenient way to pass data between the dialog and the handler that opens it.

Custom window shapes are defined by the windowShape stack property, but I'm not sure if custom window shapes can be used with modal dialogs. You'll have to test that, but I would encourage you to think about doing so very carefully, as modal dialogs are very specialized, locking the user out of all other interactions with your program, and usually follow well-defined human interface guidelines so they can be readily acted on and dismissed so the user can get back to work. Straying from the HIG conventions users are accustomed to always carries at least some risk of inadequate guidance or even confusion, and given the highly specialized role of modal dialogs even more so.

Re: Designing your own modal dialogue box from scratch

Posted: Fri Nov 15, 2013 7:51 pm
by chris25
Sounds like I have no idea now what on earth a modal dialogue box is. Typical. obviously got that wrong.

Re: Designing your own modal dialogue box from scratch

Posted: Fri Nov 15, 2013 8:24 pm
by dunbarx
Chris.

Modals? Just another stack style. Richard made a great point. Make sure you have nothing you need to save, or better, shut down LC and start a new session. Make a new mainstack. In the msg box, type "modal this stack".

You can run, but you cannot hide. The msg box is useless.

The stack can have anything a normal stack can, but if you do not have a button on it that dismisses, it, or navigates to another stack, or changes it back to something less intransigent, you will have it forever. You have to quit LC to start over. Ornery little devils. Modals generally float around, usually over other stacks, and require user input to proceed.

Craig

Re: Designing your own modal dialogue box from scratch

Posted: Fri Nov 15, 2013 8:53 pm
by Simon
Hi Chris,
Sounds like I have no idea now what on earth a modal dialogue box is.
Sure you do, you use one all the time.
The Answer box is model.
Luckily it always comes up with an "OK" button to close it down -- That is the point of all the cautions above, gotta have a way to close the darn thing or you'll never be able to work with the main stack.

Simon

Re: Designing your own modal dialogue box from scratch

Posted: Fri Nov 15, 2013 9:10 pm
by chris25
Closing down in a mac is easy guys, just hold command cntrol shift and click to bring up the contextual menu where you can then go to top level editing. At least that is the theory. But yes you are right - caution. Modal? This is where I got lost, I want to create a custom answer box with aesthetic appeal so that the user will want to keep bring it up again and again :lol: seriously, that was what I was asking, the tutorial gave no indication about this, so I asked. So I could create something in an illustrator programme and import it into LC and then place it on a substack and then follow the tutorial about the code?

chris

Re: Designing your own modal dialogue box from scratch

Posted: Fri Nov 15, 2013 9:13 pm
by dunbarx
Make a small stack just the way you want it, and pretend it is a custom answer box. Illustrator? Ptui.

Craig

Re: Designing your own modal dialogue box from scratch

Posted: Fri Nov 15, 2013 9:16 pm
by chris25
But the darn thing is square! You mean I can use the customwindowshape thingamajig-thingy-bob what-not?

(I know my terminology will annoy a few purists) :D

Re: Designing your own modal dialogue box from scratch

Posted: Fri Nov 15, 2013 9:23 pm
by Simon
Yup custom-shape-whatever

You should also look into setting the location of the stack when it opens. probably use the same loc as the main stack.

Simon

Re: Designing your own modal dialogue box from scratch

Posted: Fri Nov 15, 2013 9:44 pm
by chris25
OK simon, thankyou very much.

Re: Designing your own modal dialogue box from scratch

Posted: Fri Nov 15, 2013 9:49 pm
by Simon
I should not be so flippant
The property is windowShape

Simon

Re: Designing your own modal dialogue box from scratch

Posted: Fri Nov 15, 2013 10:16 pm
by FourthWorld
Here ya' go:

LiveCode Lessons: How to make a stack with a window shape
http://runrev.screenstepslive.com/s/les ... ndow-shape

Re: Designing your own modal dialogue box from scratch

Posted: Fri Nov 15, 2013 10:20 pm
by chris25
Ah so kind Richard, but found this last week. I was just wanting to make sure that I could actually make any type of (modal)answer box that I wanted. Hope you did not spend too much time looking for this. Now I feel guilty :cry:

Re: Designing your own modal dialogue box from scratch

Posted: Fri Nov 15, 2013 10:42 pm
by FourthWorld
No problem. I just checked, and yes indeed the modal command preserves the stack's windowShape.