Consulta sobre resolución de pantalla.

Moderator: Rathinagiri

User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Consulta sobre resolución de pantalla.

Post by esgici »

Thanks Danny :)

I was not tested Tool-Bar yet.

TIA :D
Viva INTERNATIONAL HMG :D
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Consulta sobre resolución de pantalla.

Post by Rathinagiri »

Any full updated version of AutoAdjust available?
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Consulta sobre resolución de pantalla.

Post by esgici »

Hi Rathi

Any problem after Danny's correction ?

Regards
Viva INTERNATIONAL HMG :D
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Consulta sobre resolución de pantalla.

Post by Rathinagiri »

I need that version only Esgici. All the corrections are in bits. I want the whole code.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Consulta sobre resolución de pantalla.

Post by esgici »

Rathinagiri wrote:Any full updated version of AutoAdjust available?
Auto-adjust screen shoot
Auto-adjust screen shoot
AutoAdjustD616.jpg (216.45 KiB) Viewed 5631 times
AutoAdjustD616.zip
Auto-adjust source files
(23.53 KiB) Downloaded 615 times
I'm not sure, it's "full" or not ;)

And this not updated version of original work of Miguel; adapted to MAIN.DEMO of HMG.


Regards
Viva INTERNATIONAL HMG :D
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Consulta sobre resolución de pantalla.

Post by Rathinagiri »

Thank you Esgici.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
dhaine_adp
Posts: 457
Joined: Wed Aug 06, 2008 12:22 pm
Location: Manila, Philippines

Re: Consulta sobre resolución de pantalla.

Post by dhaine_adp »

Hi Everyone,

Here's a tweak to AutoAdjust(). Backup your old code and then replaced the FOR...NEXT loop block with this:

Code: Select all

   FOR k := 1 To ControlCount
      ControlName := _HMG_SYSDATA[ 2, k ]
      
      IF _IsControlDefined ( ControlName, ParentForm )
         ControlType := _HMG_SYSDATA[ 1, k ]

         IF !EMPTY( ControlName ) .AND. ;
            !( ControlType $ "MENU,HOTKEY,TOOLBAR,MESSAGEBAR,ITEMMESSAGE,TIMER" )

            DO CASE
               CASE ControlType == "RADIOGROUP"
                  _HMG_aControlSpacing     := _HMG_SYSDATA[ 22 ]
                  _HMG_aControlMiscData1   := _HMG_SYSDATA[  8 ]
                  _HMG_aControlSpacing [k] := _HMG_aControlSpacing [k] * IIF(_HMG_aControlMiscData1 [k], nDivw, nDivh)
                  
               CASE ControlType == "SLIDER"     // do nothing
               CASE ControlType == "STATUSBAR"  // do nothing

               CASE ControlType == "TEXT"
                  _SetControlSizePos( ControlName, ParentForm,;
                  _GetControlRow( ControlName, ParentForm ) * nDivh, ;   // row
                  _GetControlCol ( ControlName, ParentForm ) * nDivw ,;  // column
                  _GetControlWidth( ControlName, ParentForm ) * nDivw,;  // with
                  _GetControlHeight ( ControlName, ParentForm ) )        // height

               CASE ControlType == "BUTTON"
                  _SetControlSizePos( ControlName, ParentForm,;
                  _GetControlRow( ControlName, ParentForm ) * nDivh, ;
                  _GetControlCol ( ControlName, ParentForm ) * nDivw ,;
                  _GetControlWidth( ControlName, ParentForm ) * nDivw,;
                  _GetControlHeight ( ControlName, ParentForm ) )        // _GetControlHeight ( ControlName, ParentForm ) * nDivh )

               CASE !ControlType $ "TOOLBUTTON"
                  _SetControlSizePos ( ControlName, ParentForm,;
                  _GetControlRow ( ControlName, ParentForm ) * nDivh, _GetControlCol ( ControlName, ParentForm ) * nDivw,;
                  _GetControlWidth ( ControlName, ParentForm ) * nDivw, _GetControlHeight ( ControlName, ParentForm ) * nDivh )
            OTHERWISE
               IF EMPTY( _HMG_SYSDATA[ 28, k ] )
                  _SetFontSize ( ControlName, ParentForm , 8 * nDivh )
               ELSE
                  _SetFontSize ( ControlName, ParentForm , _HMG_SYSDATA[28] [k] * nDivh )
               ENDIF
            ENDCASE
         ENDIF

      ENDIF
   NEXT k

What it does?
1. Basically it doesn't changed the height of TEXTBOX (TEXT), and BUTTON controls.
2. SLIDER and STATUSBAR width, height and font size never changed as well.

Its okay for me to change the width so that it can better fit the desktop width and height based on monitors resolution. However when the height (TEXTBOX, SLIDER, STATUSBAR and BUTTONS) changes the screen looks like it becomes magnified (technically this is correct but some users is not pleased by these kind of effect as a result of the aspect ratio computation).

You can add more exceptions by adding case statement such as (example):

Code: Select all

CASE ControlType == "LABEL"
   **apply your changes here
Regards,

Danny
Regards,

Danny
Manila, Philippines
User avatar
serge_girard
Posts: 3161
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Consulta sobre resolución de pantalla.

Post by serge_girard »

Very nice Steed !!!

Serge
There's nothing you can do that can't be done...
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Consulta sobre resolución de pantalla.

Post by Pablo César »

Thank you Danny for your sharing !

This your code is more stable one. :D

I have added a slider row and width and seems ok as follows:

Code: Select all

Function AutoAdjust( cForm )
Local hWnd := GetFormHandle( cForm )

Local i,;                    // From no
      k,;                    // Control no                  
      ParentForm,;  
      ControlCount,; 
      ControlName,; 
      ControlType,; 
      nWidth,; 
      nHeight,; 
      lvisible := .T.,; 
      nDivw,; 
      nDivh
      
IF GetDesktopWidth() < GetWindowWidth ( hWnd )
   nWidth := GetDesktopWidth()
ELSE
   nWidth := GetWindowWidth ( hWnd )
ENDIF

IF GetDesktopHeight() < GetWindowHeight ( hWnd )
   nHeight := GetDesktopHeight()
ELSE
   nHeight := GetWindowHeight( hWnd )
ENDIF

IF IsWindowVisible( hWnd ) .AND. ! IsAppXPThemed()
   HideWindow ( hWnd )
ELSE
   lvisible := .F.
ENDIF

i := aScan ( _HMG_SYSDATA[67], hWnd )

ParentForm := _HMG_SYSDATA[66] [i]

IF _HMG_SYSDATA[ 92, i ] > 0 .AND. _HMG_SYSDATA[ 91, i ] > 0
   nDivw := nWidth  / _HMG_SYSDATA[ 92, i]
   nDivh := nHeight / _HMG_SYSDATA[ 91, i]
ELSE
   nDivw := 1
   nDivh := 1
ENDIF

ControlCount := LEN ( _HMG_SYSDATA[ 3 ] )

FOR k := 1 To ControlCount
   ControlName := _HMG_SYSDATA[ 2, k ]
   
   IF _IsControlDefined ( ControlName, ParentForm )
      ControlType := _HMG_SYSDATA[ 1, k ]

      IF !EMPTY( ControlName ) .AND. ;
         !( ControlType $ "MENU,HOTKEY,TOOLBAR,MESSAGEBAR,ITEMMESSAGE,TIMER" )

         DO CASE
            CASE ControlType == "RADIOGROUP"
                 _HMG_aControlSpacing     := _HMG_SYSDATA[ 22 ]
                 _HMG_aControlMiscData1   := _HMG_SYSDATA[  8 ]
                 _HMG_aControlSpacing [k] := _HMG_aControlSpacing [k] * IIF(_HMG_aControlMiscData1 [k], nDivw, nDivh)
               
            CASE ControlType == "SLIDER"     // do nothing
		        _SetControlSizePos ( ControlName, ParentForm,;
                 _GetControlRow ( ControlName, ParentForm ) * nDivh, _GetControlCol ( ControlName, ParentForm ) * nDivw,;
                 _GetControlWidth ( ControlName, ParentForm ) * nDivw, _GetControlHeight ( ControlName, ParentForm ) * nDivh )
		   
            CASE ControlType == "STATUSBAR"  // do nothing

            CASE ControlType == "TEXT"
                 _SetControlSizePos( ControlName, ParentForm,;
                 _GetControlRow( ControlName, ParentForm ) * nDivh, ;   // row
                 _GetControlCol ( ControlName, ParentForm ) * nDivw ,;  // column
                 _GetControlWidth( ControlName, ParentForm ) * nDivw,;  // with
                 _GetControlHeight ( ControlName, ParentForm ) )        // height

            CASE ControlType == "BUTTON"
                 _SetControlSizePos( ControlName, ParentForm,;
                 _GetControlRow( ControlName, ParentForm ) * nDivh, ;
                 _GetControlCol ( ControlName, ParentForm ) * nDivw ,;
                 _GetControlWidth( ControlName, ParentForm ) * nDivw,;
                 _GetControlHeight ( ControlName, ParentForm ) )        // _GetControlHeight ( ControlName, ParentForm ) * nDivh )

            CASE !ControlType $ "TOOLBUTTON"
                 _SetControlSizePos ( ControlName, ParentForm,;
                 _GetControlRow ( ControlName, ParentForm ) * nDivh, _GetControlCol ( ControlName, ParentForm ) * nDivw,;
                 _GetControlWidth ( ControlName, ParentForm ) * nDivw, _GetControlHeight ( ControlName, ParentForm ) * nDivh )
         OTHERWISE
            IF EMPTY( _HMG_SYSDATA[ 28, k ] )
               _SetFontSize ( ControlName, ParentForm , 8 * nDivh )
            ELSE
               _SetFontSize ( ControlName, ParentForm , _HMG_SYSDATA[28] [k] * nDivh )
            ENDIF
         ENDCASE
      ENDIF
   ENDIF
NEXT k

_HMG_SYSDATA[92] [i] := nWidth
_HMG_SYSDATA[91] [i] := nHeight

IF lvisible
   ShowWindow ( hWnd )
ENDIF
Return Nil
I also added the new TimerPicker control and some others little changes with controls positioning in the sample demo at attached file.
Attachments
MAIN.AUTOADJUST.rar
(23.62 KiB) Downloaded 355 times
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

AutoAdjust controls by window resizing

Post by Pablo César »

Looking for ShellAbout function present in our HMG library, came again to this topic...

I've noted some bugs and corrected already in C:\hmg.3.4.0\SAMPLES\Basics\MAIN_AUTOADJUST as follows:
  1. Fixed ShellAbout() in Demo.prg
    tela1.PNG
    tela1.PNG (31.53 KiB) Viewed 5039 times
  2. Optimized code in AutoAdjust.prg for RADIOGROUP,TEXT and BUTTON (it's the same treatment)
  3. Be included in Demo.prg new TimerPicker control
Screen1.png
Screen1.png (107.78 KiB) Viewed 4914 times
In attached here is the improved DEMO for C:\hmg.3.4.0\SAMPLES\Basics\MAIN_AUTOADJUST
MAIN_AUTOADJUST.rar
Source files
(23.6 KiB) Downloaded 335 times
demo.rar
Executable file
(1.14 MiB) Downloaded 377 times

Important:

I discovered a strange behaviour, when resizing works normally in XP and in Win7 AERO mode but in CLASSIC mode is not working at all (not working anything).

And I also cutted off ISAPPXPTHEMED() because the function is not working... :cry:

B.Rgds
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Post Reply