Unfortunately the "window resizing" has been removed from the latest roadmap without any explanation. Most of the participants of the DevDay complained about this in the presence of Martin Teetz. New in the roadmap for SQLBase 12.2 is support of the .NET Core Treiber. I will post the PPT/sample files in the DevDay thread as soon as they are available. They will be sent via E-Mail to the participants.a_sivababu wrote: ↑03 Dec 2018, 05:20Good News Uwe, Any other good news from Devday and new features they discussed?
as per earlier one, the long awaiting desktop responsive design is planned in TD 7.2 but not sure this enhancement will be done or not.
As usual, any PPT and/ore sample files from this Devday
Uwe van der Horst
We assured our customers, that there will be a solution in 2019.
The amount by which a form and its fonts are resized can be controlled manually or automatically (to grow to fit the current monitor).
This has worked for TD 1.1.2 applications and through several migrations, 4.2 and 6.3 (and I believe it works ok in 7.1 too).
The core logic is about 150 lines of code and once you apply it you can just forget about it. I don't think I'm giving any secrets away if I show a tiny snippet of this:
Code: Select all
Set hWndCurrentItem = SalGetFirstChild( hWndParentForm, TYPE_Any ) While hWndCurrentItem != hWndNULL Call SalGetWindowSize( hWndCurrentItem, nWidth, nHeight ) Call SalGetWindowLoc( hWndCurrentItem, nX, nY ) Set nWidth = nWidth * nScaleX Set nHeight = nHeight * nScaleY Set nX = nX * nScaleX Set nY = nY * nScaleY Call SalSetWindowSize( hWndCurrentItem, nWidth, nHeight ) Call SalSetWindowLoc( hWndCurrentItem, nX, nY ) ! Go on to next screen object. Set hWndCurrentItem = SalGetNextChild( hWndCurrentItem, TYPE_Any )
Other benefits are we can dynamically apply a replacement font to all touched children with a given font for better readability in various environments. We can dynamically replace colours of certain items to suit colour blindness, etc.
OK, it would be nice to have native resizing but we would probably end up still using our custom resizing logic for all the additional benefits it gives.
How to calculate nScaleX and nScaleY ?
Then, call the SystemParametersInfoA() user32.dll WINAPI with action SPI_GETWORKAREA to retrieve the x1, y1, x2, y2 pixel locations of the primary monitor. Now you can work out the width and height of the primary monitor in pixels. Let's call that nWidth x nHeight.
Now you can calculate the nScaleX scaling factor simply by nWidth / nDesignWidth.
Same for nScaleY.
[EDIT] Of course, you will need to grow and position the form/dialog window too. This is just as trivial as the previous code snippet that iterated through the children of the window.
Export Ordinal: 0
First parameter should be SPI_GETWORKAREA = 0x0030
What about other parameters? Which parameter returns info about x1, y1, x2, y2 pixel locations?
- Founder/Site Admin
- Posts: 2912
- Joined: 24 Feb 2017, 09:12
- Location: Gouda, The Netherlands
It deserves its own dedicated topic
Sorry for the delay.
I haven't used the SALExtension library before but you can just define the function interface yourself as long as you know the parameters by cross-referencing against the documentation.
In this case, with action SPI_GETWORKAREA = 0x0030 as you've said, we see in the Win32 API documentation for SystemParametersInfoA that The pvParam parameter must point to a RECT structure that receives the coordinates of the work area, expressed in physical pixel size.
You can find info on how to represent the pointer to the RECT structure in your own External Function definition for user32.dll; see TD Book TD Developing with SQLWindows.pdf, section: Using C Structures (structPointer External Data Type). The 3rd parameter will be a structPointer (representing the RECT) and nested therein are the 4 x Receive Number: LONG representing the x1, y1, x2, y2 pixel values that are passed back.
If unfamiliar with calling external DLL functions, I would recommend all of Chapter 22 – Calling External Functions in Dynamic Link Libraries of the aforementioned developer's book PDF.
Who is online
Users browsing this forum: [Ccbot] and 0 guests