Random Position Window

Hi Clarion people , quick question , I need to have a small pos it window (message) to show at random places inside a window and have not idea how to code it . the idea is to come up with different reminders that are scattered around the screen / app window .
If anybody has use / code // or just plain guide me will be really great …

thanks CARLOS

The standard dialog box invoking by MESSAGE is displaying centered relatively

  • the MDI frame if it’s running and active, otherwise
  • the topmost active window in the thread where MESSAGE has been executed, otherwise
  • the active not-Clarion window opened by the program if any, otherwise
  • monitor where program is running

You can use the SYSTEM{PROP:MessageHook} property to set your code invoking by

How about using GETPOSITION on your main application window to get some idea of its width and height, then create your own message procedure with a window positioned using SETPOSITION ?

What’s wrong with using a small window with random X & Y co-ordinates? Or am I not understanding the question correctly?

1 Like

Hi Paul, thanks for the comment , I have just basic Windows and small databases knowledge , and couldn’t find any code in the Help section to just do that , if you can share a simple code and where to insert in the embedded section will really appreciate. Unfortunately with clarion sometimes some of the basic coding are hard to understand . thanks ,

You don’t mean a ToolTip do you?
That’s a part of the control and can popup text when the mouse is over the control.
If so you can set that in the control properties

Need to know what you mean by “Window” and/or what kind of Windows. Some screen captures of what you have now will help.

What is the underlying Window MDI or Non-MDI or a Frame ?

In your “Message Window” before the Open(Window) you will still be able to access the previous (under) window (in the same thread) using GETPOSITION() so you can read it’s position.

Off the cuff and untested…

    !Data definitions Embed
UwX  LONG    !Under Window Position  X / Y
UwY  LONG    
UwW  LONG    ! Width
UwH  LONG    ! Height

MsX  LONG    !Message Window Position (Original) 
MsY  LONG    
MsW  LONG    

RnX  LONG    !Random Message Window Position over Under Window
RnY  LONG    

!This code in Message Procedure embed BEFORE Open Window 

0{PROP:Pixels}=True   !Needed if different Fonts, good idea even if fonts same
GETPOSITION(0,UwX,UwY,UwW,UwH)   !Get Under Window Position 

!Open(Window) or ThisWindow.Init() SELF.open(Window)

!This code in Message Procedure embed AFTER Open Window + AFTER Resize
!Resize.Init()   may not be present

0{PROP:Pixels}=True  !Needed if different Fonts, good idea even if fonts same
GETPOSITION(0,MsX,MsY,MsW,MsH)    !Get Under Window Position  
RnX = RANDOM(UwX,UwX+UwW - MsW)   !Random X over width of Under Window
RnY = RANDOM(UwY,UwY+UwH - MsH) 

This code assumes both Windows use the same Font.


Thank you vey much ! I did it and it works , I love clarion but I found very difficult to do some of the coding , unfortunate is very hard to find help , once again thanks for your generosity and time .

Cheers Carlos

BTW the windows was just a message , and sometimes my program generate several messages and having one on the top of another was an inconvenient , but generating a random position help me to know that have x messages .

Hi Carlos,

sometimes my program generate several messages and having one on the top of another was an inconvenient

Just a thought: you can have your messages automatically added to file. This might work for you: to be able to see your messages, perhaps the last few, or whatever. For example, you can then sort them or search them or filter them, normal things you do for files.
This is what the MessageBox template from CapeSoft does.

Hi there , yes I did got mesboxsp and it working great , thanks for the tip