Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Mandatory Pause after positive Message Box Response
#1
Hi,

It seems like I cant run a user-defined function until I put a mandatory 2.0 pause after a message box response. Is this right? Any help on a workaround

Code:
Copy      Help
sel(mes("Question" "Rad Fusion" "YNC?a"))
,case 'Y' goto g1
,case 'N'
,,dis+ "SignOffPrelimStatementCheck"        
,,mac "sample macro"
,,ret
,case 'C'
,,dis+ "SignOffPrelimStatementCheck"
,,mac "another sample macro"
,,ret
;g1    

2.0

ErasePrelimStatement            

out "got here"
key (VK_F12)

If it might make a difference, the background app has a richedit dialog that the cursor is in when the message box is invoked
Thanks,
Stuart
#2
Quote:It seems like I cant run a user-defined function

Why? The target window does not respond? I remember a similar case. Don't remember what program it was, but the window did not respond 1 or several seconds after activating. Try to use menu instead. It does not deactivate the currently active window.
#3
Hi Gintaras,

Thanks for the suggestion about menu. I implemented it like this:

Code:
Copy      Help
mac "sample menu"
mou+ 0 15

;sample menu
;Do action? :mac "DoAction_Function
;Don't do action :mac "DontDoAction_Function"


I added the "mou+ 0 15" so that it sets the "default" focus to the first option so that all the user has to do is hit "return".
This is fast and doesn't require the 2sec mandatory pause to return focus to the application from the message box default/focus.

It's not as elegant as the message box, however. The message box has the Title, icons, and look of a professional windows program (the application I am scripting shortcuts in, to be specific). Plus the effect on screen is small i.e. 2 little lines as opposed to a dialog box, etc.

Anyway, just wondering if there was anyway around this or to "dress up" a menu list a little bit.

I thought about making a dialog instead of Message Box but I think they would act similar if they had a "default" key set up. Am I right?

Thanks for your input.

Stuart

ps. Maybe I will try putting an OnscreenDisplay with opaque background to surround the menu items to kind of make a mimic of a message box....
#4
Hi,

It turns out I couldnt make a combination of OnScreenDisplay and Menu Items work because the background of the OnScreenDisplay covers the menu items. However, it seems that List does the trick (i.e. looks like a regular dialog but doesnt steal focus even though you can set a default (executes with a press of Return key). The user-defined macro (now in the "Yes Macro" instead of in the same macro executes immediately after the user enters the choice.

Code:
Copy      Help
str SignOffChoices = "&Yes[]No"
sel list(SignOffChoices "" "Sample Question?" 0 0 0 0 1)
,case 1 mac "Yes Macro"
,case 2 mac "No Macro"
,case else out "Cancel"

One additional question: There are a lot of extra lines - I geuss assuming that there would be many choices but with two, I dont need so much white space. Anyway to tighten this up. (like a character that indicates this is the last choice so should size the box appropriately?

This would be good for Toolbars also. It is often that I am spending a lot of time resizing toolbars manually.

Not trying to make extra work for you - just sharing ideas. Thanks for all your help!!
Stuart
#5
The number of lines cannot be changed.

If list works, then maybe custom dialog also works. Try to create.
#6
Thanks Gintaras,
I will let you know if custom dialog works.

Stuart


Forum Jump:


Users browsing this thread: 1 Guest(s)