# Random Position Window

**URL:** <https://clarionhub.com/t/random-position-window/6270>\
**Category:** questions\
**Tags:** form\
**Created:** [May 25, 2023, 2:30am UTC](https://clarionhub.com/t/random-position-window/6270 "2023-05-25T02:30:01Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![elextronika](https://clarionhub.com/user_avatar/clarionhub.com/elextronika/32/4045_2.png) [@elextronika](https://clarionhub.com/u/elextronika)\
**Post date:** [May 25, 2023, 2:30am UTC](https://clarionhub.com/t/random-position-window/6270/1 "2023-05-25T02:30:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![anon77170705](https://clarionhub.com/letter_avatar_proxy/v4/letter/a/ecccb3/32.png) [@anon77170705](https://clarionhub.com/u/anon77170705)\
**Post date:** [May 25, 2023, 11:23am UTC](https://clarionhub.com/t/random-position-window/6270/2 "2023-05-25T11:23:33Z")

</div>

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  
MESSAGE.

---

<div class="post-metadata">

**Author:** ![Julian](https://clarionhub.com/letter_avatar_proxy/v4/letter/j/74df32/32.png) [@Julian](https://clarionhub.com/u/Julian)\
**Post date:** [May 25, 2023, 1:15pm UTC](https://clarionhub.com/t/random-position-window/6270/3 "2023-05-25T13:15:37Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![PaulAttryde](https://clarionhub.com/user_avatar/clarionhub.com/paulattryde/32/3519_2.png) [@PaulAttryde](https://clarionhub.com/u/PaulAttryde)\
**Post date:** [May 26, 2023, 8:40pm UTC](https://clarionhub.com/t/random-position-window/6270/4 "2023-05-26T20:40:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![elextronika](https://clarionhub.com/user_avatar/clarionhub.com/elextronika/32/4045_2.png) [@elextronika](https://clarionhub.com/u/elextronika)\
**Post date:** [May 27, 2023, 11:37pm UTC](https://clarionhub.com/t/random-position-window/6270/5 "2023-05-27T23:37:08Z")

</div>

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 ,

---

<div class="post-metadata">

**Author:** ![seanh](https://clarionhub.com/letter_avatar_proxy/v4/letter/s/4af34b/32.png) [@seanh](https://clarionhub.com/u/seanh)\
**Post date:** [May 28, 2023, 9:57am UTC](https://clarionhub.com/t/random-position-window/6270/6 "2023-05-28T09:57:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![CarlBarnes](https://clarionhub.com/user_avatar/clarionhub.com/carlbarnes/32/1859_2.png) [@CarlBarnes](https://clarionhub.com/u/CarlBarnes)\
**Post date:** [May 29, 2023, 10:56pm UTC](https://clarionhub.com/t/random-position-window/6270/7 "2023-05-29T22:56:25Z")

</div>

> [@elextronika](#):
>
> 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 .

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…

```auto
    !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    
MsH 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 
0{PROP:Pixels}=False

!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) 
SETPOSITION(0,RnX,RnY)
0{PROP:Pixels}=False

```

This code assumes both Windows use the same Font.

---

<div class="post-metadata">

**Author:** ![elextronika](https://clarionhub.com/user_avatar/clarionhub.com/elextronika/32/4045_2.png) [@elextronika](https://clarionhub.com/u/elextronika)\
**Post date:** [May 30, 2023, 7:34am UTC](https://clarionhub.com/t/random-position-window/6270/8 "2023-05-30T07:34:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![elextronika](https://clarionhub.com/user_avatar/clarionhub.com/elextronika/32/4045_2.png) [@elextronika](https://clarionhub.com/u/elextronika)\
**Post date:** [May 30, 2023, 7:39am UTC](https://clarionhub.com/t/random-position-window/6270/9 "2023-05-30T07:39:37Z")

</div>

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 .

---

<div class="post-metadata">

**Author:** ![softwaretailor](https://clarionhub.com/user_avatar/clarionhub.com/softwaretailor/32/5553_2.png) [@softwaretailor](https://clarionhub.com/u/softwaretailor)\
**Post date:** [June 1, 2023, 6:20pm UTC](https://clarionhub.com/t/random-position-window/6270/10 "2023-06-01T18:20:56Z")

</div>

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.  
[https://www.capesoft.com/accessories/mesboxsp.htm](https://www.capesoft.com/accessories/mesboxsp.htm)  
-Bob

---

<div class="post-metadata">

**Author:** ![elextronika](https://clarionhub.com/user_avatar/clarionhub.com/elextronika/32/4045_2.png) [@elextronika](https://clarionhub.com/u/elextronika)\
**Post date:** [July 23, 2023, 9:08pm UTC](https://clarionhub.com/t/random-position-window/6270/11 "2023-07-23T21:08:15Z")

</div>

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