Window resizing

Discussion forum about all things Gupta, OpenText and the community.
Uwe van der Horst
Site Admin
Site Admin
Germany
Posts: 488
Joined: 05 Mar 2017, 14:21
Location: Wetter (Ruhr), Germany

Window resizing

Post by Uwe van der Horst » 03 Dec 2018, 14:17

a_sivababu wrote:
03 Dec 2018, 05:20
Good 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
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.
Best regards,
Uwe van der Horst
Advo-web GmbH

OeavDev
Austria
Posts: 86
Joined: 15 May 2018, 11:18
Location: Vienna

Re: Restriction of the OpenText Forum will be canceled

Post by OeavDev » 05 Dec 2018, 08:59

Any news on "window resizing" topic?

We assured our customers, that there will be a solution in 2019.

wardies
Great Britain
Posts: 91
Joined: 21 Mar 2017, 10:44
Location: UK

Re: Restriction of the OpenText Forum will be canceled

Post by wardies » 24 Jan 2019, 17:42

We solved our own window resizing issue several years ago by hiding each window on SAM_Create, then calling a helper function to iterate through all child items, enlarging window size and position, and font size, by the required amount, and then making the form visible again on SAM_CreateComplete. This logic can be placed in a General Window class that all forms/dialogs are derived from.

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 )
There are obviously lots of corner cases: coping with different types of objects, child tables, tab bars, etc. That's why the actual code is more complex.

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.

aspurga
Lithuania
Posts: 119
Joined: 06 Mar 2017, 08:54
Location: Lithuania

Re: Restriction of the OpenText Forum will be canceled

Post by aspurga » 25 Jan 2019, 07:02

Hello Mr. Wardies

How to calculate nScaleX and nScaleY ?

Arunas

wardies
Great Britain
Posts: 91
Joined: 21 Mar 2017, 10:44
Location: UK

Re: Restriction of the OpenText Forum will be canceled

Post by wardies » 25 Jan 2019, 09:24

First, estimate the pixel size of your largest window form (e.g. 600x450). Let's call these constants nDesignWidth x nDesignHeight.

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.

aspurga
Lithuania
Posts: 119
Joined: 06 Mar 2017, 08:54
Location: Lithuania

Re: Restriction of the OpenText Forum will be canceled

Post by aspurga » 25 Jan 2019, 13:24

In SALExtension library found only

Function: SystemParametersInfoW
Description:
Export Ordinal: 0
Returns
Boolean: BOOL
Parameters
Number: UINT
Number: UINT
Number: LPVOID
Number: UINT

First parameter should be SPI_GETWORKAREA = 0x0030
What about other parameters? Which parameter returns info about x1, y1, x2, y2 pixel locations?

Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 2912
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

Re: Window resizing

Post by Dave Rabelink » 25 Jan 2019, 20:16

I have moved the posts on window resizing out of the topic "Restriction of the OpenText Forum will be canceled" and put them in this one.
It deserves its own dedicated topic :)
Regards,
Dave Rabelink

Image
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel

wardies
Great Britain
Posts: 91
Joined: 21 Mar 2017, 10:44
Location: UK

Re: Window resizing

Post by wardies » 04 Feb 2019, 16:12

Thank you, Dave.

Hi Arunas,

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.

aspurga
Lithuania
Posts: 119
Joined: 06 Mar 2017, 08:54
Location: Lithuania

Re: Window resizing

Post by aspurga » 07 Feb 2019, 15:02

A feature request:

TD-24383
Allow Zooming of all TD child control in top level window including anchoring feature

Return to “General Discussion”

Who is online

Users browsing this forum: [Ccbot] and 0 guests