The Close command

Hi guys:

I want a function to create and then close an xmessage dialog box… but so far, I can get the message to open but not close.

I have a simple bit of code:

AddToFunc OpenAndCloseXmessage
+ I Exec exec xmessage "here is my xmessage"
+ I Schedule 100 CloseXmessage

AddToFunc CloseXmessage
+ I All (xmessage) Close

can anyone see anything wrong with this? I sure can’t…

thanks in advance,
skender

I found it…

I wasn’t giving xmessage enough time to finish instantiating. changing the scheduling delay to 500 from 100, when calling CloseXmessage, works just fine.

AddToFunc OpenAndCloseXmessage
+ I Exec exec xmessage "here is my xmessage"
+ I Schedule 500 CloseXmessage

AddToFunc CloseXmessage
+ I All (xmessage) Close

-skender

You can use one function[code]AddToFunc OpenAndCloseXmessage

  • I Exec exec xmessage “here is my xmessage”
  • I Schedule 500 All (xmessage) Close[/code]

true. I was just trying to show a full separation in the logic :slight_smile:

thanks for the input.

  • Skender

I don’t know where you use it for, but I use xosd for displaying messages for a few seconds on screen.

Old, but it’s worth mentioning:

No, no, no! “All” does just what you think it does – it matches every instance. Use “Next” where you want the specific (and likely) window to be closed.

Note also (more importantly) that xmessage has a -timeout flag to it to make itself close after a known interval. Far too many people seem to think that the WM is there to circumvent an application’s shortcoming. It’s not!

– Thomas Adam