How to change the position of answer Dialog

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

Post Reply
kevin007
Posts: 40
Joined: Mon Sep 21, 2015 7:46 am

How to change the position of answer Dialog

Post by kevin007 » Tue Mar 08, 2016 10:05 am

How I change the position af answer Dialog. is it possible to change the position ? :(
--
Thanks
Kevin

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

Re: How to change the position of answer Dialog

Post by richmond62 » Tue Mar 08, 2016 11:07 am

I tired this:

on mouseUp
set the lockScreen to true
set the moveSpeed to 65000
answer "Is this the correct place?" with "yes" or "no"
move the stack "Answer Dialog" to 700,700
set the lockScreen to false
end mouseUp

but it didn't work

when I tried this in the MessageBox:

move the stack "Answer Dialog" to 700,700

and, then, tried the script the answer dialog still appeared centred on the main stack.

You will probably have to make yourself a home-made answer stack.

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

Re: How to change the position of answer Dialog

Post by richmond62 » Tue Mar 08, 2016 11:28 am


Klaus
Posts: 11319
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: How to change the position of answer Dialog

Post by Klaus » Tue Mar 08, 2016 12:06 pm

Hi Richmond,

for years I have been asking myself why you always MOVE things,
when just SETting their LOC would be a more effective and instantaneous solution? :D


Best

Klaus

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

Re: How to change the position of answer Dialog

Post by richmond62 » Tue Mar 08, 2016 7:08 pm

Maybe because I am NOT entirely "LOCO" :P

However this:

on mouseUp
toplevel stack "Answer Dialog"
set the loc of stack "Answer Dialog" to 700,700
set the lockMoves to true
answer "Is this the correct place?" with "yes" or "no"
set the lockMoves to true
end mouseUp


still doesn't work.

Klaus
Posts: 11319
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: How to change the position of answer Dialog

Post by Klaus » Tue Mar 08, 2016 7:36 pm

Hi Richmoind,
richmond62 wrote:Maybe because I am NOT entirely "LOCO" :P
AHA! I thought because you just "like to move it, move it!" :D
richmond62 wrote:

Code: Select all

on mouseUp
    toplevel stack "Answer Dialog"
    set the loc of stack "Answer Dialog" to 700,700
    ##set the lockMoves to true
    answer "Is this the correct place?" with "yes" or "no"
    ##set the lockMoves to true
end mouseUp
still doesn't work.
Sorry, never bothered to dive deeper into this mistery...
But I think "answer xyz" will trigger the "preopenstack" script of that stack which will override all previous
loc settings and changes of the window layering (toplevel etc.)


Best

Klaus

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

Re: How to change the position of answer Dialog

Post by richmond62 » Tue Mar 08, 2016 8:33 pm

Yes, it does over ride everything, and that is USELESS if one wants the ANSWER window somewhere
other than plumb-dead-centre of your main stack.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7037
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: How to change the position of answer Dialog

Post by FourthWorld » Tue Mar 08, 2016 9:43 pm

Another option is to set the loc as a custom property in the Answer Dialog stack, and use a frontscript to trap preOpenCard, check if the name of the stack is "answer dialog", and if so set the loc per the prop.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

FredBeck
Posts: 77
Joined: Fri Nov 01, 2013 3:07 pm
Location: Paris
Contact:

Re: How to change the position of answer Dialog

Post by FredBeck » Tue Mar 08, 2016 10:31 pm

Fun!
Two handlers and a local (or whatever)
Try this with the backdrop off.

Code: Select all

local sLoc

on mouseUp
   lock screen
   put the loc of this stack into sLoc
   set the loc of this stack to 380,380
   send "ResetLoc" to me in .1 tick
   answer "Is this the correct place?" with "yes" or "no"
end mouseUp

command ResetLoc
   set the loc of this stack to sLoc
end ResetLoc
Is it acceptable?

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3324
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: How to change the position of answer Dialog

Post by bn » Tue Mar 08, 2016 10:42 pm

Richmond linked to a very nice solution offered by RunRev Neil Roger

in script of stack

Code: Select all

local sShiftAnswer

on suspendStack
   if sShiftAnswer then
      if "answer dialog" is among the lines of the openStacks then
         set the topLeft of stack "answer dialog" to the topLeft of this stack -- change location to what you want here in global coordinates
      end if
   end if
end suspendStack

setProp shiftAnswer pBool
   put pBool into sShiftAnswer
end shiftAnswer
script of button:

Code: Select all

on mouseUp
   set the shiftAnswer of this stack  to true
   answer "what time is it?"  & cr & the milliseconds
   set the shiftAnswer of this stack  to false
end mouseUp
I just added the setProp stuff to avoid unnecessary checking on "suspendStack"

It works well for me.

Kind regards
Bernd

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”