Hi Edward,
Thank you for your kind and quick response!
(My knowledge of C is, unfortunately, less than yours).
Perhaps this "corner" is not normally implemented in HMG.
My own Resize code accurately resizes the columns in GRIDs and BROWSEs.
To these windows I just want some way to include the "Resize Corner" graphic.
Is there is any other way this can be done in HMG?
=======================
¿Hay alguna otra forma en que esto se pueda hacer en HMG?
=======================
I would greatly appreciate anyone's suggestions or guidance here.
Thanks again,
Red2
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
Re: Rezise window limit, how i do ?
Hi Red2, Maybe this...
At the end of the form
Add this control in the reposition function when resizing.
It won't actually do anything but warn the user that the window can be resized.
I didn't find .png icon but you can search the internet.
At the end of the form
Code: Select all
DEFINE IMAGE Image_Resize
ROW Main.ClientAreaHeight - 20
COL Main.ClientAreaWidth - 20
WIDTH 20
HEIGHT 20
ONCLICK Nil
PICTURE "Your_Transparent_.png_Icon"
STRETCH .T.
HELPID Nil
VISIBLE .T.
TRANSPARENT .T.
BACKGROUNDCOLOR {255,255,255} // <- Your back color
ADJUSTIMAGE .F.
TRANSPARENTCOLOR Nil
TOOLTIP "Resize"
END IMAGE
It won't actually do anything but warn the user that the window can be resized.
I didn't find .png icon but you can search the internet.
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
- 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, I do this icon in transparent .png with Gimp white and black color 20x20 px.
- Attachments
-
- Grip20.zip
- (416 Bytes) Downloaded 103 times
-
- Grip20B.zip
- (426 Bytes) Downloaded 101 times
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 ?
Or following Claudio's idea to use Label instead of Image:
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 BACKCOLOR {120,150,255} ON PAINT PaintSizeGrip( ThisWindow.Name ) 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>
//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
********************************
FUNCTION PaintSizeGrip( cWName )
Local nRow, nCol
IF !Empty ( cWName )
nRow := GetProperty ( cWName, "ClientAreaHeight" ) - 10
nCol := GetProperty ( cWName, "ClientAreaWidth" ) - 10
IF .Not. _IsControlDefined ( "SizeGrip", cWName )
@ nRow, nCol Label SizeGrip OF &cWName VALUE Chr ( 0x79 ) AUTOSIZE FONT "Wingdings 3" SIZE 10 TRANSPARENT
ELSE
SetProperty ( cWName, "SizeGrip", "Row", nRow )
SetProperty ( cWName, "SizeGrip", "Col", nCol )
ENDIF
ENDIF
RETURN
A small hint: ON PAINT can also be used instead of the ON SIZE eventClaudio Ricardo wrote: ↑Wed Mar 23, 2022 6:47 am Add this control in the reposition function when resizing.
-
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 ?
Thank you Claudio and Edward,
Your kind guidance looks promising.
However, I have not been able to get Claudio's actual .PNG image, "SizeGrip",
to appear in the bottom right corner. Instead, just a black square displays.
Despite my attempts, the .PNG image is not being displayed.
My Question:
What am I doing wrong or missing?
I would appreciate any and all suggestions.
----------------------------------------------
¿Qué estoy haciendo mal o omitiendo?
Agradecería cualquier y todas las sugerencias.
----------------------------------------------
From the .RC:
The IMAGE definition in the .FMG file:
Your kind guidance looks promising.
However, I have not been able to get Claudio's actual .PNG image, "SizeGrip",
to appear in the bottom right corner. Instead, just a black square displays.
Despite my attempts, the .PNG image is not being displayed.
My Question:
What am I doing wrong or missing?
I would appreciate any and all suggestions.
----------------------------------------------
¿Qué estoy haciendo mal o omitiendo?
Agradecería cualquier y todas las sugerencias.
----------------------------------------------
From the .RC:
Code: Select all
SizeGrip PNG Grip_Resize.PNGCode: Select all
DEFINE IMAGE imgResizeGrip
ROW 325
COL 363
WIDTH 20
HEIGHT 20
PICTURE "SizeGrip"
HELPID Nil
VISIBLE .T.
STRETCH .T.
ACTION Nil
END IMAGE- Attachments
-
- GripNotVisible.PNG (3.42 KiB) Viewed 1267 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... TRANSPARENT .T. and posibly also need set backcolor, when define image control (see my code)
Attention ! HMG Ide delete this line when open .fmg for edit...
you need put it editing manually the .fmg file.
Edward code using LABEL instead IMAGE is best option.
Attention ! HMG Ide delete this line when open .fmg for edit...
you need put it editing manually the .fmg file.
Edward code using LABEL instead IMAGE is best option.
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