` Comment on an Icetips Article
Icetips - Templates, Tools & Utilities for Clarion Developers

Templates, Tools and Utilities
for Clarion Developers

Add a comment to an Icetips Article

Please add your comments to this article. Please note that you must provide both a name and a valid email address in order for us to publish your comment. Comments are moderated and are not visible until they have been approved. Spam is never approved!

Your Name:  
Email:  
Header text/Subject:  

Please enter your comment in the box below:

Back to article list   Search Articles     Add Comment     Printer friendly     Direct link  

Par2: Popup menus -- specifying location dynamically
1998-05-15 -- Arnor Baldvinsson
 
>When I use x and y coordinates to specify the location for a popup menu, >can I make those x and y coordinates refer to my MDI Frame instead of my >desktop? I've hit this problem and solved it. The reason for the odd positioning is that the position for the popup MUST be in pixels, not dialog units. But using pixels is not enough, because popup menus are positioned relative to the screen, not the window. So if you have a popup at 100,100 pixels and your window is not maximized the popup menu will not appear related to where your window is, but at 100,100 from the top left corner of the SCREEN! Now, the solution is very simple and requires one simple api call ClientToScreen. It takes two parameters, the window handle and a pointer to a POINT structure. The Point structure is declared as: POINT GROUP,TYPE X SIGNED Y SIGNED END and the call is prototyped in 16bit: Module('WIN16.LIB') ClientToScreen(HWND, *POINT),PASCAL,RAW End 32 bit: Module('WIN32.LIB') ClientToScreen(HWND, *POINT),PASCAL,RAW End To use it: Loc:Point POINT Loc:Xpos SIGNED Loc:Ypos SIGNED Code Loc:Point.X = ?MyControl{Prop:Xpos} Loc:Point.Y = ?MyControl{Prop:Ypos} If ClientToScreen(Window{Prop:Handle},Loc:Point) Loc:Xpos = Loc:Point.X Loc:Ypos = Loc:Point.Y Else Message('Could not convert client to screen') End I'm going a bit from memory here, but I think this is pretty much all you need to do. I don't remember if I had to set the Window{Prop:Pixels}=True before getting the X/Y positions for the control, seem to recall it worked with DLU too.


Today is December 3, 2024, 11:39 am
This article has been viewed 35344 times.



Back to article list   Search Articles   Add Comment   Printer friendly

Login

User Name:

Password: