setting the location of an "ask" dialog window

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
churchken
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 66
Joined: Sun Apr 15, 2007 2:54 pm

setting the location of an "ask" dialog window

Post by churchken » Fri May 11, 2007 11:10 pm

Hi,

Is there a way to move the "ask" window away from the main stack window so the ask window does not overlay the main stack card when the user is being asked to provide an input?

Thanks,
Ken

oliverk
Site Admin
Site Admin
Posts: 53
Joined: Mon Feb 27, 2006 2:16 pm

Post by oliverk » Mon Jun 25, 2007 4:40 pm

Hi Ken,

The ask dialog has been designed to set itself to the location of the current default stack. This is because the dialog is supposed to be used when urgent input is needed from the user before execution can continue.

It may be possible to trick the dialog into appearing at another location, but I wouldn't recommend doing this. Instead you should consider why you want the dialog to open at another location and whether the information should be obtained another way (for example a text field or popup group).

If you still want to hack this, the following code will allow you to open an ask dialog whever you want on the screen, however I cannot guarantee this code will continue to work in future versions of Revolution as the ask dialog code may change.

Code: Select all

on askAtLocation pQuestion, pLocation
  local tDefaultStack
  put the defaultStack into tDefaultStack
  
  lock messages
  local tTempStack
  create invisible stack
  put the long id of it into tTempStack
  set the location of tTempStack to pLocation
  unlock messages
  
  local tAskResult
  
  set the defaultStack to tTempStack
  ask pQuestion
  put it into tAskResult
  set the defaultStack to tDefaultStack
  
  lock messages
  delete tTempStack
  unlock messages
  
  return tAskResult
end askAtLocation
I would strongly advise against using this code, but if are needing to get it working very quickly, you could use it as a temporary workaround. I think that the best solution is to devise your own method of obtaining the information from the user by showing / hiding controls on the current card.

Hope this is some help.

Regards
Oliver
Oliver Kenyon
Software Developer
Runtime Revolution

Garrett
Posts: 386
Joined: Sat Apr 08, 2006 8:15 am
Contact:

Post by Garrett » Mon Jun 25, 2007 10:01 pm

I have just the need for this myself and for the following reason. I'm making an application launcing menu bar. It's just a menu bar that autohides at the top of the screen, or is always open at the top of the screen. It's only 24 pix in height, sits at 0 and 0 on the screen and runs the length of the screen. When a dialog box is opened, it opens at the center and absolute top of the screen which is not very professional looking or normal at all. So this is one instance where needing to have the dialog boxes open at defined location would be required.

churchken
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 66
Joined: Sun Apr 15, 2007 2:54 pm

location of an ask window

Post by churchken » Wed Jun 27, 2007 2:38 am

Oliver -- Thanks for the reply.

I certainly appreciate your help.

The issue in my case was that the ask dialog box was "covering up" data on the active stack card. To see that data, the dialog box must then be moved to a different location. Or, the size of the active card had to be changed first, stretching it out, so the pertinent data was no longer covered by the dialog box. Using ask "with" multiple fields was not really an efficient way to ask for the input, either.

I agree with Garrett, the ability to set the box location would be helpful.

Again, thanks for your assistance.
Ken

urbaud
Posts: 120
Joined: Tue Feb 24, 2009 12:10 am

Re: setting the location of an "ask" dialog window

Post by urbaud » Mon Jun 07, 2010 8:06 am

Hi Oliver,
I'm curious, but also relatively new to Rev. I was doing a search in the forum and I came across the code you displayed on Jun 25/07 to Ken regarding "setting the location of an "ask" dialog window. I'm curious about what it will do, but I don't know how to make it work. I tried putting it in a onMouseUp handler, but nothing happened. Could you tell me how to make it work so I can ease my curiosity? Thanks.
Dan
urbaud

Post Reply