viewpoint-particle

Author Topic: Resize a dynamic dialog - Updating font size of text controls  (Read 532 times)

cssyphus

  • Jr. Member
  • **
  • Posts: 69
  • Let's go Brandon
Resize a dynamic dialog - Updating font size of text controls
« on: January 11, 2022, 07:45:27 am »
I have allowed users to resize and reposition a dynamic dialog. I would like to adjust the font size of the STATICTEXT/VARYTEXT controls as the dialog is resized, so that words do not disappear as borders change. When I use a variable in the dialog definition, thus:

TestWin003=`008,042,200,080,STATICTEXT,"SuPb_St01",DEFAULT,%vt_AdjustWin%,DEFAULT,500,DEFAULT,"Microsoft Sans Serif|%_dlgFontSize%|40|34","%t_DlgTextColor%",DEFAULT`

the text size does not change during the resize activity. So how can I do this?  My second thought was that there might be a DialogControlSet() setting for that, but I am not seeing one that affects the font settings of a STATICTEXT or VARYTEXT control.

I also tried setting:
   DialogProcOptions(tw2_Hnd, @dpoDisable, 3)
before changing the _dlgFontSize value, and then
   DialogProcOptions(tw2_Hnd, @dpoDisable, 0)
after changing the _dlgFontSize variable value (thinking that might force the dialog to redraw), but no joy.

There must be a way to do this since there is a resize event and one can watch the values of the dialog's width/height change in tiny increments... surely there must be a way to change the size and position of the text in the dialog as its dimensions change..?
Is this a pandemic... or an IQ test? newz.icu

td

  • Tech Support
  • *****
  • Posts: 4044
    • WinBatch
Re: Resize a dynamic dialog - Updating font size of text controls
« Reply #1 on: January 11, 2022, 08:18:50 am »
As is often the case with previously plowed subjects, there are numerous examples of dialog control moving and resizing in the Tech Database. Below is a randomly selected link to one of them:

https://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/Dialog~Editor/Dialog~Editor~version~6.2/Samples+Resize~Dialog~and~Controls~Dynamically.txt

Perform a Tech Database search to find more examples.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

cssyphus

  • Jr. Member
  • **
  • Posts: 69
  • Let's go Brandon
Re: Resize a dynamic dialog - Updating font size of text controls
« Reply #2 on: January 11, 2022, 09:56:02 am »
Tony, I'm sorry to be obtuse, but I don't see anything in that example - or in any of the other dynamic dialog examples in that folder - about the font size of STATICTEXT/VARYTEXT controls.

I see that one can show/hide controls, get the new dimensions of the dialog, change the positioning in the dialog of the controls -- but nothing about changing the font size. 

Is it necessary to use DEFAULT in the font field in order for the text to dynamically resize, or does STATIC/VARY text font-size simply not resize until the dialog is closed/reopened?

If I've missed something right in front of my face (a distinct possibility with my nystagmus condition), would you mind pointing it out?
Is this a pandemic... or an IQ test? newz.icu

td

  • Tech Support
  • *****
  • Posts: 4044
    • WinBatch
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

cssyphus

  • Jr. Member
  • **
  • Posts: 69
  • Let's go Brandon
Re: Resize a dynamic dialog - Updating font size of text controls
« Reply #4 on: January 11, 2022, 01:06:10 pm »
With respect Tony, plowed territory to you and the mavens but not to me... first time I'd even imagined such a question.

Thank you very much for pointing me to this specific article and to the exact place in the article that answers my question. I now understand how to proceed.
Is this a pandemic... or an IQ test? newz.icu

td

  • Tech Support
  • *****
  • Posts: 4044
    • WinBatch
Re: Resize a dynamic dialog - Updating font size of text controls
« Reply #5 on: January 12, 2022, 10:09:05 am »
With respect Tony, plowed territory to you and the mavens but not to me... first time I'd even imagined such a question.


The point is to have some consideration of those that take the time to answer posts. Perform a thorough search of the available resources before asking a question. Sometimes you need to take a few stabs with different terms when searching the Tech Database before you find an answer.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

td

  • Tech Support
  • *****
  • Posts: 4044
    • WinBatch
Re: Resize a dynamic dialog - Updating font size of text controls
« Reply #6 on: January 12, 2022, 02:28:50 pm »
Admittedly, the Tech Database search engine is a bit rudimentary by today's Web search engine standards. It takes a little getting used to, patience, and some creativity but good information can usually be found. We are always looking for a better search approach that doesn't also compromise WinBatch user privacy. We just haven't found one that meets our standards yet.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

archimede

  • Jr. Member
  • **
  • Posts: 56
Re: Resize a dynamic dialog - Updating font size of text controls
« Reply #7 on: January 23, 2022, 09:21:06 am »
Hallo.
I have a similar problem.
WinBatch engineer told me WinBatch no supports font resize.
I made a very complex system to obtain it: it no works fo a continuous resize, bu only, for example, for zooming full screen or resize normal.
Are you interested?
I tell you it is a very complex system...

Archimede

cssyphus

  • Jr. Member
  • **
  • Posts: 69
  • Let's go Brandon
Re: Resize a dynamic dialog - Updating font size of text controls
« Reply #8 on: January 23, 2022, 09:47:43 am »
Hi Archimede,

Yes, I am interested to see your solution, thank you for offering to share.

If you have solved that problem, then maybe you also know the answer to my most current problem re translating dialog units to screen units. Are you willing to look at that problem also? You might already know the answer "off the top of your head"... If so, then I will open a new question to describe that other problem. (I've been "banging my head against the wall" re that problem for a few days now...)

Again, many thanks for your kind offer.
Is this a pandemic... or an IQ test? newz.icu

td

  • Tech Support
  • *****
  • Posts: 4044
    • WinBatch
Re: Resize a dynamic dialog - Updating font size of text controls
« Reply #9 on: January 23, 2022, 12:23:07 pm »
Assuming I understand the problem correctly, the translation of dialog units to logical pixels is covered in the Tech Database:

https://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+Tutorials+Screen~Coordinates~Explained.txt
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

archimede

  • Jr. Member
  • **
  • Posts: 56
Re: Resize a dynamic dialog - Updating font size of text controls
« Reply #10 on: January 23, 2022, 01:06:40 pm »
Hallo.
Like I told you before, the solution is no simple, is hard; and after this, it no works if you no exit and re-enter in the Dialog managing with Dialog (...) function.
Before all you must declare all varialbles that defines Dialo like global.
I made a subroutine to make that, but it is all Italian commented (yes, I am Italian and you?): is it right for you?

archimede

  • Jr. Member
  • **
  • Posts: 56
Re: Resize a dynamic dialog - Updating font size of text controls
« Reply #11 on: January 23, 2022, 01:57:28 pm »
Hallo.
If you need to know translation from dialog unit to screen pixels to right calculate the new font dimension, with my method it is no necessary to know it.

cssyphus

  • Jr. Member
  • **
  • Posts: 69
  • Let's go Brandon
Re: Resize a dynamic dialog - Updating font size of text controls
« Reply #12 on: January 23, 2022, 02:01:36 pm »
Yes, I am interested to see your solution. Thank you Archimede.
Is this a pandemic... or an IQ test? newz.icu

archimede

  • Jr. Member
  • **
  • Posts: 56
Re: Resize a dynamic dialog - Updating font size of text controls
« Reply #13 on: January 23, 2022, 02:44:08 pm »
I am sorry for my bad English.
Now I am far to my computer, then I can tell some things; tomorrow I will begin to send you some function.
The trick is to modify the variables that defines the dialog (that are at the common level in the program) from the internal of the function that manages all dialog event: is necessary to modify a dialog from the internal of the dialog!
Before all, at the common level (I think you define the dialog at the common level) you must declare global all variables that defines the dialog.
From the internal of the function that manages dialog event you must declare a persistent pointer for every global variable.
After that you can use the persistent pointer to modify a variable that defines the dialog (that is at upper level, but from the internal of a function is possible to modify an external variable by the pointer to that variable): in that mode you can define a new font and a new dimension font for the variable that defines dialog.
After that you have no finished: the dialog variables was red before, then the new changes have no effect: now you must exit from the dialog and re-enter with Dialog (...) function: now the Dialog (...) function read new values of the dialog define variables, with the new font definitions.
I explained you all now to help you to understand all futures functions that I can send (when I will near to my computer).