Rezise window limit, how i do ?
Moderator: Rathinagiri
- Claudio Ricardo
- Posts: 367
- Joined: Tue Oct 27, 2020 3:38 am
- DBs Used: DBF, MySQL, MariaDB
- Location: Bs. As. - Argentina
Rezise window limit, how i do ?
Hola
Se puede setear un tamaño minimo limite al redimensionamiento de una ventana ?
Que no la puedan achicar mas de lo especificado por mi ? Es para evitar que se solapen los controles.
Algo asi como en el administrador de tareas de W7.
Desde yá muchas gracias !
Hello
Is it possible to set a minimum size limit to the resizing of a window?
That they cannot shrink it more than what is specified by me? This is to prevent controls from overlapping.
Something like in the task manager of W7.
Thanks in advance !
Se puede setear un tamaño minimo limite al redimensionamiento de una ventana ?
Que no la puedan achicar mas de lo especificado por mi ? Es para evitar que se solapen los controles.
Algo asi como en el administrador de tareas de W7.
Desde yá muchas gracias !
Hello
Is it possible to set a minimum size limit to the resizing of a window?
That they cannot shrink it more than what is specified by me? This is to prevent controls from overlapping.
Something like in the task manager of W7.
Thanks in advance !
Corrige al sabio y lo harás más sabio, Corrige al necio y lo harás tu enemigo.
WhatsApp / Telegram: +54 911-63016162
WhatsApp / Telegram: +54 911-63016162
Re: Rezise window limit, how i do ?
Maybe...
DEFINE WINDOW <WindowName> AT <nRow> ,<nCol> WIDTH <nWindth> HEIGHT <nHeight>
.
. ON SIZE PonerLimites()
Andrés González López
Desde Guadalajara, Jalisco. México.
Desde Guadalajara, Jalisco. México.
- Claudio Ricardo
- Posts: 367
- Joined: Tue Oct 27, 2020 3:38 am
- DBs Used: DBF, MySQL, MariaDB
- Location: Bs. As. - Argentina
Re: Rezise window limit, how i do ?
Gracias por contestar Andy
En ON SIZE llamo a la función que redimensiona los controles, lo que no sé es cómo fijar por ejemplo
Form Min Width = 1000 Form Min Height = 700 y que al llegar a alguno de esos valores, el usuario no pueda seguir
achicando la ventana, tal como sucede en la ventana del administrador de tareas de W7.
Thanks for answering Andy.
In ON SIZE I call the function that resizes the controls, what I don't know is how to set for example
Form Min Width = 1000 Form Min Height = 700 and that when reaching any of those values, the user cannot continue
shrinking the window, just like in the W7 task manager window.
En ON SIZE llamo a la función que redimensiona los controles, lo que no sé es cómo fijar por ejemplo
Form Min Width = 1000 Form Min Height = 700 y que al llegar a alguno de esos valores, el usuario no pueda seguir
achicando la ventana, tal como sucede en la ventana del administrador de tareas de W7.
Thanks for answering Andy.
In ON SIZE I call the function that resizes the controls, what I don't know is how to set for example
Form Min Width = 1000 Form Min Height = 700 and that when reaching any of those values, the user cannot continue
shrinking the window, just like in the W7 task manager window.
Corrige al sabio y lo harás más sabio, Corrige al necio y lo harás tu enemigo.
WhatsApp / Telegram: +54 911-63016162
WhatsApp / Telegram: +54 911-63016162
Re: Rezise window limit, how i do ?
Claudio,
In the ON RESIZE function you use, u can limit the size by defining a minimum width en height. For example:
Theo
In the ON RESIZE function you use, u can limit the size by defining a minimum width en height. For example:
Code: Select all
ON RESIZE AutoAdjust( cForm ,nMinWidth ,nMinHeight, nMaxWidth ,nMaxHeight )Code: Select all
nMinWidth := iif(nMinWidth =NIL,0,nMinWidth )
nMinHeight := iif(nMinHeight=NIL,0,nMinHeight)
nMaxWidth := iif(nMaxWidth =NIL,GetDesktopWidth() ,nMaxWidth )
nMaxHeight := iif(nMaxHeight=NIL,GetDesktopHeight(),nMaxHeight)
IF GetDesktopWidth() < GetWindowWidth ( hWnd )
nWidth := GetDesktopWidth()
ELSEIF GetWindowWidth(hWnd) < nMinWidth
SetProperty ( cForm , "Width" , nMinWidth )
nWidth := nMinWidth
ELSEIF GetWindowWidth(hWnd) > nMaxWidth
SetProperty ( cForm , "Width" , nMaxWidth )
nWidth := nMaxWidth
ELSE
nWidth := GetWindowWidth ( hWnd )
ENDIF
IF GetDesktopHeight() < GetWindowHeight ( hWnd )
nHeight := GetDesktopHeight()
ELSEIF GetWindowHeight ( hWnd ) < nMinHeight
SetProperty ( cForm , "Height" , nMinHeight )
nHeight := nMinHeight
ELSEIF GetWindowHeight ( hWnd ) > nMaxHeight
SetProperty ( cForm , "Height" , nMaxHeight )
nHeight := nMaxHeight
ELSE
nHeight := GetWindowHeight( hWnd )
ENDIF
- Claudio Ricardo
- Posts: 367
- Joined: Tue Oct 27, 2020 3:38 am
- DBs Used: DBF, MySQL, MariaDB
- Location: Bs. As. - Argentina
Re: Rezise window limit, how i do ?
Thank you very much Theo and Andy, problem solved thanks to your help !
Corrige al sabio y lo harás más sabio, Corrige al necio y lo harás tu enemigo.
WhatsApp / Telegram: +54 911-63016162
WhatsApp / Telegram: +54 911-63016162
Re: Rezise window limit, how i do ?
Other solution:
Code: Select all
#include "hmg.ch"
FUNCTION Main()
Local nEvent, nMinHeight := 350, nMinWidth := 550, nMaxHeight := 400, nMaxWidth := 650
DEFINE WINDOW Test AT 157 , 162 WIDTH nMinWidth HEIGHT nMinHeight TITLE "Hello World!!!!!" MAIN ON PAINT PaintSizeGrip( ThisWindow.Handle ) ON RELEASE EventRemove ( nEvent )
DEFINE MAIN MENU
DEFINE POPUP "File"
MENUITEM "Some item" ACTION MsgInfo ( "Some item" )
SEPARATOR
MENUITEM "Exit" ACTION ThisWIndow.Release
END POPUP
END MENU
nEvent := EventCreate( { || SetMinMaxTrackSize( EventLPARAM(), nMinWidth, nMinHeight, nMaxWidth, nMaxHeight ) }, test.HANDLE, 36 /*WM_GETMINMAXINFO*/ )
// only min size defined
// nEvent := EventCreate( { || SetMinMaxTrackSize( EventLPARAM(), nMinWidth, nMinHeight ) }, test.HANDLE, 36 /*WM_GETMINMAXINFO*/ )
END WINDOW
Center Window Test
Activate Window Test
RETURN NIL
***********************************************************************************
#pragma BEGINDUMP
#include "windows.h"
#include "hbapi.h"
#include "hbapiitm.h"
#include "SET_COMPILE_HMG_UNICODE.ch"
#include "HMG_UNICODE.h"
#include <windowsx.h>
#include <commctrl.h>
#include <shlobj.h>
//PaintSizeGrip(nHWnd)
HB_FUNC( PAINTSIZEGRIP )
{
HWND hWnd;
PAINTSTRUCT ps;
RECT rc;
HDC hdc;
hWnd = (HWND) HMG_parnl(1);
hdc = BeginPaint(hWnd, &ps);
if (hdc)
{
GetClientRect(hWnd, &rc);
rc.left = rc.right - GetSystemMetrics(SM_CXVSCROLL);
rc.top = rc.bottom - GetSystemMetrics(SM_CYVSCROLL);
DrawFrameControl(hdc, &rc, DFC_SCROLL, DFCS_SCROLLSIZEGRIP);
EndPaint(hWnd, &ps);
}
}
//SetMinMaxTrackSize(lParam, nMinX, nMinY, nMaxX, nMaxY)
HB_FUNC( SETMINMAXTRACKSIZE )
{
MINMAXINFO *MinMax = (MINMAXINFO *) HMG_parnl(1);
if (hb_parni(2) > 0)
MinMax->ptMinTrackSize.x = hb_parni(2);
if (hb_parni(3) > 0)
MinMax->ptMinTrackSize.y = hb_parni(3);
if (hb_parni(4) > 0)
MinMax->ptMaxTrackSize.x = hb_parni(4);
if (hb_parni(5) > 0)
MinMax->ptMaxTrackSize.y = hb_parni(5);
}
#pragma ENDDUMP
********************************
- Claudio Ricardo
- Posts: 367
- Joined: Tue Oct 27, 2020 3:38 am
- DBs Used: DBF, MySQL, MariaDB
- Location: Bs. As. - Argentina
Re: Rezise window limit, how i do ?
Hi Edward, you code WORK PERFECT !!!!
I had done:
But when reaching the minimum limit established both in width and height, it produced flashes in the window that were very annoying to the eye.
Your code doesn't do them and it's like it disables the mouse drag when it reaches the limit, exactly what I wanted !!!
Extremely grateful for your help !!!
I had done:
Code: Select all
Function Main_Form_OnSize // called from Main OnSize
LOCAL nMainHeight := GetProperty ("Main" , "Height")
LOCAL nMainWidth := GetProperty ("Main" , "Width")
If nMainWidth < 1000
SetProperty ("Main" , "Width" , 1000)
Return Nil
EndIf
If nMainHeight < 700
SetProperty ("Main" , "Height" , 700)
Return Nil
EndIf
// here another control's resize and positioning
Your code doesn't do them and it's like it disables the mouse drag when it reaches the limit, exactly what I wanted !!!
Extremely grateful for your help !!!
Corrige al sabio y lo harás más sabio, Corrige al necio y lo harás tu enemigo.
WhatsApp / Telegram: +54 911-63016162
WhatsApp / Telegram: +54 911-63016162
-
Red2
- Posts: 282
- Joined: Sat May 18, 2019 2:11 pm
- DBs Used: Visual FoxPro, FoxPro
- Location: United States of America
Re: Rezise window limit, how i do ?
Hi Edward,
Thank you for your very helpful post. The part that I needed (and really appreciate your sharing) was your
//PaintSizeGrip(nHWnd)
HB_FUNC( PAINTSIZEGRIP )
code. I did not know how to do this in HMG.
I added your code to my form which has a BACKCOLOR.
Unfortunately the PAINTSIZEGRIP image displays opaquely.
Its background Gray overwrites my form's {255,250,240} BACKCOLOR.
My Question:
Is there any way to display this kind of a "resize" corner transparently to show my forms BACKCOLOR?
============================
Google Spanish
¿Hay alguna forma de mostrar este tipo de esquina de "cambio de tamaño" de forma transparente para mostrar mis formularios BACKCOLOR?
============================
Thank you,
Red2

Thank you for your very helpful post. The part that I needed (and really appreciate your sharing) was your
//PaintSizeGrip(nHWnd)
HB_FUNC( PAINTSIZEGRIP )
code. I did not know how to do this in HMG.
I added your code to my form which has a BACKCOLOR.
Unfortunately the PAINTSIZEGRIP image displays opaquely.
Its background Gray overwrites my form's {255,250,240} BACKCOLOR.
My Question:
Is there any way to display this kind of a "resize" corner transparently to show my forms BACKCOLOR?
============================
Google Spanish
¿Hay alguna forma de mostrar este tipo de esquina de "cambio de tamaño" de forma transparente para mostrar mis formularios BACKCOLOR?
============================
Thank you,
Red2
- Attachments
-
- CornerResizeImage.PNG (940 Bytes) Viewed 3341 times
- Claudio Ricardo
- Posts: 367
- Joined: Tue Oct 27, 2020 3:38 am
- DBs Used: DBF, MySQL, MariaDB
- Location: Bs. As. - Argentina
Re: Rezise window limit, how i do ?
Hi Red2... the same thing happened to me so I didn't use PaintSizeGrip () function in OnPaint.
Corrige al sabio y lo harás más sabio, Corrige al necio y lo harás tu enemigo.
WhatsApp / Telegram: +54 911-63016162
WhatsApp / Telegram: +54 911-63016162
Re: Rezise window limit, how i do ?
Hi Red2.Red2 wrote: ↑Mon Mar 21, 2022 10:56 pm Is there any way to display this kind of a "resize" corner transparently to show my forms BACKCOLOR?
============================
¿Hay alguna forma de mostrar este tipo de esquina de "cambio de tamaño" de forma transparente para mostrar mis formularios BACKCOLOR?
Unfortunately, the description on the page https://docs.microsoft.com/en-us/window ... amecontrol shows that the transparency attribute (DFCS_TRANSPARENT) can only be used with DFCS_MENUARROWUP or DFCS_MENUARROWDOWN. My knowledge of C is very limited to the basics. I am not able to help with this problem, but as Claudio wrote, you can skip the grip drawing.