Hi,
Normally the answer and ask dialogs are horizontally and vertically centered. I'd like to center it horizontally but place it about 2/3 from the top.
I've searched the forum for this and did not find any simple clear answers.
One of them is from FourthWorld http://forums.livecode.com/viewtopic.ph ... wer+dialog
function AlertLoc
return item 1 of the screenLoc, (item 4 of the screenRect div 5 )*2
end AlertLoc
but I don't know how to apply this. Anybody could explain or maybe give another solution?
Thanks!
keram
How to set the location of an Answer/Ask dialog
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
How to set the location of an Answer/Ask dialog
Using the latest stable version of LC Community 6.7.x on Win 7 Home Premium, 64bit
Re: How to set the location of an Answer/Ask dialog
Hi Keram,
There is a little stack that does the job
Best regards
Jean-Marc
There is a little stack that does the job
Best regards
Jean-Marc
- Attachments
-
- Reset loc of the Answer dialog box.zip
- (7.52 KiB) Downloaded 236 times
https://alternatic.ch
Re: How to set the location of an Answer/Ask dialog
Thanks Jean-Marc,
I tested that stack and it works very well in IDE and in the Windows standalone but in Android standalone it does not.
Since I want that answer dialog to show up when the Android back key is tapped on while the first card is visible, I adjusted the code in this way:
in the stack:
in the card:
Is it something that I have to specifically add or change for Android?
keram
I tested that stack and it works very well in IDE and in the Windows standalone but in Android standalone it does not.
Since I want that answer dialog to show up when the Android back key is tapped on while the first card is visible, I adjusted the code in this way:
in the stack:
Code: Select all
on backKey
if the number of this card is 1 then
pass backKey
else
go to the previous card
end if
end backKey
in the card:
Code: Select all
on mouseUp
lock screen for visual effect
unlock screen with visual effect dissolve to white very slow
go cd "firstQ"
end mouseUp
on backKey
put loc of stack "allin1P" into tStackLoc
put (item 2 of tStackLoc) * 1.25 into item 2 of tStackLoc
setAnswerLoc tStackLoc
answer question "Do you want to exit the app?" with "Yes" or "No"
if it is "Yes" then quit
setAnswerLoc "abc" --This should do nothing and should not throw an error.
setAnswerLoc --This should restore the default loc
end backKey
on setAnswerLoc tLoc
local answerScript, tScript, tCount, tParams, tLineNo, tNewScriptLine
put the answerScript of this card into tScript
if tScript is "" then
put the script of card 1 of stack "answer dialog" into tScript
set the answerScript of this card to tScript
-- Best to keep a clean copy of that script somewhere accessible
end if
put the paramcount into tCount
put the params into tParams
switch tCount
case 0
set the script of card 1 of stack "answer dialog" to the answerScript of this card
exit setAnswerLoc
break
default
delete word 1 of tParams
replace quote with "" in tParams
put tParams into tLoc
if word 1 of item 1 of tLoc is not a number or word 1 of item 2 of tLoc is not a number then
--Abandon ship. Reset the default script for the answer stack.
set the script of card 1 of stack "answer dialog" to the answerScript of this card
exit setAnswerLoc
end if
end switch
put lineoffset("end preOpenStack", tScript) into tLineNo
--Write the line of code to immediately preceed "End preOpenStack"
put "Set the loc of this stack to "& tLoc into tNewScriptLine
--Alter the script
--Change the last line of PreOpenStack to the following 2 lines.
put tNewScriptLine & cr & "end preOpenStack" into line tLineNo of tScript
--Set the new script.
set the script of card 1 of stack "answer dialog" to tScript
end setAnswerLoc
keram
Using the latest stable version of LC Community 6.7.x on Win 7 Home Premium, 64bit
-
- VIP Livecode Opensource Backer
- Posts: 10052
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: How to set the location of an Answer/Ask dialog
Mobile has very specific needs that are quite different from the desktop. While it may be possible to come up with a solution for positioning LC's ask/answer dialogs in specific locations for specific moments for one specific app, it would seem much easier to just make a group that overlays your UI to do exactly what you want however you want it.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: How to set the location of an Answer/Ask dialog
Hi Keram,
As Richard said, group is a easy way in your case and you can customize it for each use
I think you can have only one group for all dialog. Just place this group onto the current cd when you need it.
More. This dialog will be more accessible than the classic dialog
As Richard said, group is a easy way in your case and you can customize it for each use
I think you can have only one group for all dialog. Just place this group onto the current cd when you need it.
More. This dialog will be more accessible than the classic dialog
https://alternatic.ch