Open a centered modal?

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
dburdan
Posts: 104
Joined: Fri Jan 28, 2011 5:39 am

Open a centered modal?

Post by dburdan » Thu Feb 10, 2011 2:00 am

Hi,
I am trying to open a modal that is automatically centered on top of the current stack. For example, I need user input so I made a modal stack. I can open it fine but I want it to be half the size of the stack that opens it and be centered on the screen. Example:

What I have:
Image

What I want:
Image

The back box is the modal stack.

RickD
Posts: 31
Joined: Thu Feb 11, 2010 5:47 pm

Re: Open a centered modal?

Post by RickD » Thu Feb 10, 2011 3:19 am

Hi dburdan:

I have attached a sample stack that does what you want.

It has a preopenCard script and two button scripts. Very staraight forward.

Hope this helps.

Cheers
Attachments
MainStack.zip
(668 Bytes) Downloaded 333 times

dburdan
Posts: 104
Joined: Fri Jan 28, 2011 5:39 am

Re: Open a centered modal?

Post by dburdan » Thu Feb 10, 2011 6:29 pm

That works great for the computer however I'm building on iOS. Every time I open a modal window It covers the whole screen. I can't get the sides to be transparent.

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

Re: Open a centered modal?

Post by Klaus » Thu Feb 10, 2011 7:24 pm

Hi Dan,

since iOS is a ONE window environment, there can only be ONE stack on the screen at a time
and it will cover the complete screen! So what you wnat to achieve is simply impossible (right now).

I would fake this by creating a card in your current stack that LOOKS as if a modal dialog is open over my stack :D


Best

Klaus

dburdan
Posts: 104
Joined: Fri Jan 28, 2011 5:39 am

Re: Open a centered modal?

Post by dburdan » Thu Feb 10, 2011 7:40 pm

Ok, thanks once again Klaus :D!

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

Re: Open a centered modal?

Post by Klaus » Thu Feb 10, 2011 8:03 pm

Dan, think different! :D

SteveHanlan
Posts: 80
Joined: Fri Jul 09, 2010 6:28 pm

Re: Open a centered modal?

Post by SteveHanlan » Thu Feb 10, 2011 9:05 pm

I create a control whose visible is false until I need it.
Combine this with a function that disables other visible controls temporarily and you have an effective modal pop-up

If you can stand illogical control names, I name them sequentially, i.e. c1, c2, c3, etc. This make it easy to enable/disable in a repeat loop

Cheers

Steve

dburdan
Posts: 104
Joined: Fri Jan 28, 2011 5:39 am

Re: Open a centered modal?

Post by dburdan » Fri Feb 11, 2011 12:36 am

Thanks Steve I think I'll try that! My game is about 95% done so far! Can't wait to release it to the appstore! As far as you Klaus, I think we should vote an award or something for you!

Post Reply