Dynamic dialog coordinates vs Box functions coordinates (reversed)

Started by cssyphus, January 24, 2022, 07:30:40 AM

Previous topic - Next topic

cssyphus

I have a large legacy WB app that delivers regular messages using Box functions. For various reasons, they cannot be converted to the newer Dynamic Dialog format.

Users often want to relocate the size and position of these message boxes, so they can drag the window borders and the box will detect and remember the new position.

However, when they need to move it from one monitor to another, this is a poor solution - stretching the poor message box the full width of the monitor... and if the message times out and the box closes during the resize, not a good solution.

So, I created another method (see attached) whereby they can resize and reposition a dynamic dialog box, and then those coordinates are used to redisplay the next message box.

However, I have been unable to work out how to convert the adjusted dynamic dialog position to assign the next position for the next box-functions message box.

Perhaps I've missed a TechDB article, or a Forum post - or maybe I have not correctly implemented Tony's DlgUnitOrigin() function from this thread:
https://forum.winbatch.com/index.php?topic=1116.msg5338#msg5338

It seems to me that the examples show how to make this conversion in the other direction... that I need to convert in the opposite direction to methods shown, and my lone-functioning, liberal arts brain cell hasn't been able to work out the math.

The attached mock-up / example is the guts of this procedure in (what I hope is) a well laid out example, easy to follow.

I would greatly appreciate assistance identifying where I've gone wrong and how to fix the demo so that the final message box displays exactly in the position where the "Adjust Window Size and Position" dialog was positioned.

It's a very simple demo - running it one time will show how it works, and what the problem is.  The demo creates two output files, a debugTrace log and an ini file. To reset to vanilla, delete the ini file.

PS - The attachment with a bitmap file is too large, so I included it as a .jpg - convert the .jpg to a .bmp (Irfanview?). The sole purpose of the BMP file was to show that there is a background corporate graphic (not the one enclosed) that users generally try to keep "in proportion" (circles being round rather than oblong) as they adjust the dialog size/position.


JTaylor

Is this what you are trying to do?  I just did my own rather than trying to figure out your code.

Jim

cssyphus

Could the answer be that simple? Your example:

a. Appears to do exactly what I need
b. Is super-simple and straightforward
c. Is super-helpful

Many Thanks Jim. I'll test it fully with my app when I have a moment (it's Monday) but . . . at this point, it looks like the solution. Boyzzz, if it is... I'm going right out to purchase one of those K-Tel machines that kick you in the butt when you wake up in the morning.


JTaylor

Glad to help and hope it works.   I think it is what you want, based on your post.

Jim