Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Move and resize controls at run time

Status
Not open for further replies.

JPG77

Programmer
Mar 22, 2002
27
FR
I try to resize and move image control at run time (and editbox too (move) ...). It's seems impossible to handle the control, change the border (with the 8 points like VFP) and the resize.
If somebody can help me, ... this will be great.
JPG from Paris
 
JPG77

Have you looked at the samples provided in the "solutions" provided with VFP?
There are mamy events to handle when you want to emplement Drag and Drop. This link describes the different events.:
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mike,
Thanks for your prompt and helpfull answer.

I'have resolved my problems for Image Control et shape.
I'm still looking for resize and move a textbox at run time.
Long is the road ...

[thumbsup2]
JpG
 
JPG77

Here is a sample of moving a textbox and a command button at runtime (resizing might be a little more tricky). Copy the following in a program and run it to see how it works.
Code:
PUBLIC oform1
oform1=NEWOBJECT("form1")
oform1.Show
RETURN
DEFINE CLASS form1 AS form
	DoCreate = .T.
	Caption = "Form1"
	Name = "Form1"
	ADD OBJECT command1 AS commandbutton WITH ;
		DragMode = 1, ;
		Top = 60, ;
		Left = 228, ;
		Height = 27, ;
		Width = 84, ;
		Caption = "Command1", ;
		Name = "Command1"
	ADD OBJECT text1 AS textbox WITH ;
		DragMode = 1, ;
		Height = 23, ;
		Left = 36, ;
		Top = 48, ;
		Width = 100, ;
		Name = "Text1"
	PROCEDURE DragDrop
		LPARAMETERS oSource, nXCoord, nYCoord
		oSource.Left = nXCoord
		oSource.Top = nYCoord 
	ENDPROC
	PROCEDURE command1.DragDrop
		LPARAMETERS oSource, nXCoord, nYCoord
		THIS.Parent.DragDrop(oSource, nXCoord, nYCoord)
	ENDPROC
	PROCEDURE text1.DragDrop
		LPARAMETERS oSource, nXCoord, nYCoord
		THIS.Parent.DragDrop(oSource, nXCoord, nYCoord)
	ENDPROC
ENDDEFINE

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
JPG77


There ia also a sample called "resize and reposition controls at runtime", in the VFP solutions. Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mike,

Thanks for your example.
This solution with Automatic Drag Drop (DragMode=1) was not good for me because I have to open a contextuel menu when the user right click on the edit control. And with DragMode=1 right button move the control. So ...

Is'it possible to open a menu with the mouse right button, while DragMode=1 on the Edit Control ??

... and sorry for my poor english ...

[thumbsup2]
JpG
 
Mike,

Ok, I find what I wanted.
DragMode=1 and test the mouse button.

Thousand of tahnks.


JpG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top