EditBox - Resizable

Creative ideas/suggestions for HMG

Moderator: Rathinagiri

User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

EditBox - Resizable

Post by Pablo César »

Hi HDT and others,

How about to add an option in EditBox to accept SizeProcedure and let to final users to resize this control :?:

I have experienced adding WS_SIZEBOX at INITEDITBOX function in c_editbox.c and you can test this attached executable file and give your opinion if you want:
Screen1.png
Screen1.png (12.89 KiB) Viewed 4557 times
Sometimes users would need to size EditControl and at that time could be actioned an UDF (User Defined Function) which could allow to resize form or execute others routines following the EditBox resizing. ;)
demo_WS_SIZEBOX.rar
Executable demo file
(1.12 MiB) Downloaded 276 times
All for improvings that would all enjoyed it ! :D
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
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: EditBox - Resizable

Post by serge_girard »

This is a great Pablo !

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

EditBox - Resizable

Post by Pablo César »

Good to know this could be useful.

Thank you for expressing opinions Serge ! :D

Now shall see HDT reaction to evaluate for impletation in HMG.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: EditBox - Resizable

Post by mol »

Nice sample!
But, It should be possibility to limit size by programmer, I think. (Maybe it's done?)
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

EditBox - Resizable

Post by Pablo César »

Thank you Marek for your interest.
mol wrote:But, It should be possibility to limit size by programmer, I think. (Maybe it's done?)
Yes I also believe this could it be possible if EditControl could allow to insert something like this:
ON SIZE <{SizeProcedure}> as new property of control (new style).

I also was looking also for this:
figure1.gif
figure1.gif (5.44 KiB) Viewed 4549 times
Its name is RESIZE CONTROL.

But I do not know how to do it. All these demmands need for HDT be approved and better implement.
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

EditBox - Resizable

Post by Pablo César »

It is also posible to limit which can be allow for sizing side.

Thru WM_NCHITTEST can know it.

https://msdn.microsoft.com/en-us/librar ... s.85).aspx
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: EditBox - Resizable

Post by srvet_claudio »

In this example you move and resize a Grid control:

Code: Select all

#define WS_CAPTION 0x00C00000
#define WS_SIZEBOX 0x00040000

HMG_ChangeWindowStyle ( Form_1.Grid_1.Handle, WS_CAPTION + WS_SIZEBOX, NIL, .F., .T. )
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

EditBox - Resizable

Post by Pablo César »

Thanks Claudio,

So, you mean that no need to mess in HMG source code to get EditBox as Resizable with:
HMG_ChangeWindowStyle ( Form_1.Edit_1.Handle, WS_SIZEBOX, NIL, .F., .T. )

Code: Select all

/*
 * HMG - Harbour Win32 GUI library Demo
 *
 * Copyright 2010 Roberto Lopez <mail.box.hmg@gmail.com>
 * http://www.hmgforum.com//
*/

#include "hmg.ch"
#define WS_CAPTION 0x00C00000
#define WS_SIZEBOX 0x00040000

Function Main

	DEFINE WINDOW Form_1 ;
		AT 0,0 ;
		WIDTH 640 HEIGHT 480 ;
		TITLE 'HMG Demo' ;
		ICON 'DEMO.ICO' ;
		MAIN 

		DEFINE STATUSBAR
			STATUSITEM 'HMG Power Ready!' 
		END STATUSBAR

		@ 30,10 EDITBOX Edit_1 ;
			WIDTH 410 ;
			HEIGHT 140 ;
			VALUE 'EditBox!!' ;
			TOOLTIP 'EditBox' ;
			MAXLENGTH 255 ;
			ON CHANGE ShowRowCol() ;
			DISABLEDBACKCOLOR { 0,0,255} ;
         nohscroll;
			DISABLEDFONTCOLOR { 0,255,0 } 


		DEFINE BUTTON B
			ROW	250
			COL	10
			WIDTH	130
			CAPTION 'Set CaretPos'
			ACTION ( Form_1.Edit_1.CaretPos := Val(InputBox('Set Caret Position','')) , Form_1.Edit_1.SetFocus )
		END BUTTON

		DEFINE BUTTON C
			ROW	250
			COL	150
			WIDTH	130
			CAPTION	'Set ReadOnly .T.'
			ACTION	Form_1.Edit_1.ReadOnly := .T.
		END BUTTON

		DEFINE BUTTON D
			ROW	250
			COL	290
			WIDTH	130
			CAPTION	'Set ReadOnly .F.'
			ACTION	Form_1.Edit_1.ReadOnly := .F.
		END BUTTON
		
		DEFINE BUTTON E
			ROW	250
			COL	430
			WIDTH	130
			CAPTION	'Set Resizable'
			ACTION HMG_ChangeWindowStyle ( Form_1.Edit_1.Handle, WS_SIZEBOX, NIL, .F., .T. )
		END BUTTON

	END WINDOW

	Form_1.Center()

	Form_1.Activate()

Return Nil

Procedure ShowRowCol
Local s , c , i , e , q 
	
	s := Form_1.Edit_1.Value
	c := Form_1.Edit_1.CaretPos
	e := 0
	q := 0

	for i := 1 to c
		if substr ( s , i , 1 ) == chr(13)
			e++
			q := 0
		Else
			q++
		EndIf
	Next i

	Form_1.StatusBar.Item(1) := 'Row: ' + alltrim(Str(e+1)) + ' Col: ' + alltrim(Str(q))

Return
But what about with:
Pablo César wrote:
Mol wrote:But, It should be possibility to limit size by programmer, I think. (Maybe it's done?)
Yes I also believe this could it be possible if EditControl could allow to insert something like this:
ON SIZE <{SizeProcedure}> as new property of control (new style).
And
Pablo César wrote:Sometimes users would need to size EditControl and at that time could be actioned an UDF (User Defined Function) which could allow to resize form or execute others routines following the EditBox resizing.
Is it posible to insert UDF in On Sizing event ?
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: EditBox - Resizable

Post by mol »

I'm using resizing of labels in my label manager. I forgot about this solution :-)
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: EditBox - Resizable

Post by andyglezl »

Hola
Yo creo que el problema va a estar en como manejar o controlar hasta donde se puede hacer
"Resize" del control ya que afectaría a los demás controles que estan alrededor.
------------------------------------------------------------------------------------------------------------
hello
I think the problem will be how to manage or control up to where you can do
"Resize" control as it would affect the other controls that are around.
ResizeControl.jpg
ResizeControl.jpg (76.76 KiB) Viewed 4510 times
Andrés González López
Desde Guadalajara, Jalisco. México.
Post Reply