Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Positioning A Form Relative To A Toobar
Message
De
03/04/2008 21:48:58
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01308084
Message ID:
01308125
Vues:
12
Update: I wonder why the right edge has to be adjusted (I have to subtract 4 to get it lined up correctly)? It works if you move the toolbar too, but I guess a check should be put in place to verify that you don't open the form outside of the visible area by accident)

Your code works for me (very cool by the way, I didn't even think of this):
PUBLIC oTbr1

oTbr1 = NEWOBJECT("toolbar1")
oTbr1.Show()
oTbr1.dock(0)

DEFINE CLASS toolbar1 AS toolbar

	Caption = "Toolbar1"
	Height = 28
	Left = 500
	Top = 0
	Width = 63
	Name = "mytoolbar"

	ADD OBJECT command1 AS commandbutton WITH ;
		Top = 3, ;
		Left = 5, ;
		Height = 22, ;
		width = 100, ;
		Caption = "LeftEdge", ;
		Name = "Command1"


	ADD OBJECT separator1 AS separator WITH ;
		Top = 3, ;
		Left = 35, ;
		Height = 0, ;
		Width = 0, ;
		Name = "Separator1"


	ADD OBJECT command2 AS commandbutton WITH ;
		Top = 3, ;
		Left = 35, ;
		Height = 22, ;
		width = 100, ;
		Caption = "LeftEdge", ;
		Name = "Command2"

	ADD OBJECT command3 AS commandbutton WITH ;
		Top = 3, ;
		Left = 35, ;
		Height = 22, ;
		width = 100, ;
		Caption = "LeftEdge", ;
		Name = "Command3"

	ADD OBJECT command4 AS commandbutton WITH ;
		Top = 3, ;
		Left = 35, ;
		Height = 22, ;
		width = 100, ;
		Caption = "RightEdge", ;
		Name = "Command4"

	ADD OBJECT command5 AS commandbutton WITH ;
		Top = 3, ;
		Left = 35, ;
		Height = 22, ;
		width = 100, ;
		Caption = "LeftEdge", ;
		Name = "Command5"

	ADD OBJECT command6 AS commandbutton WITH ;
		Top = 3, ;
		Left = 35, ;
		Height = 22, ;
		width = 100, ;
		Caption = "RightEdge", ;
		Name = "command6"

	PROCEDURE command1.Click
		=RunForm(0,this.parent.left+this.left)
	ENDPROC

	PROCEDURE command2.Click
		=RunForm(0,this.parent.left+this.left)
	ENDPROC
	PROCEDURE command3.Click
		=RunForm(0,this.parent.left+this.left)
	ENDPROC
	PROCEDURE command4.Click
		=RunForm(0,this.parent.left+this.left+this.width-4,.T.)
	ENDPROC
	PROCEDURE command5.Click
		=RunForm(0,this.parent.left+this.left)
	ENDPROC
	PROCEDURE command6.Click
		=RunForm(0,this.parent.left+this.left+this.width-4,.T.)
	ENDPROC


	PROCEDURE command1.RightClick
		DEFINE POPUP myshortcut shortcut RELATIVE FROM MROW()+1,MCOL()
		DEFINE BAR 1 OF myshortcut PROMPT "sm1" 
		DEFINE BAR 2 OF myshortcut PROMPT "sm2"
		DEFINE BAR 3 OF myshortcut PROMPT "am3"
		ACTIVATE POPUP myshortcut		
	ENDPROC

	PROCEDURE command2.RightClick
		DEFINE POPUP myshortcut shortcut RELATIVE FROM MROW(),MCOL()
		DEFINE BAR 1 OF myshortcut PROMPT "sm1-2" 
		DEFINE BAR 2 OF myshortcut PROMPT "sm2-2"
		DEFINE BAR 3 OF myshortcut PROMPT "am3-2"
		ACTIVATE POPUP myshortcut		
	ENDPROC

ENDDEFINE

PROCEDURE runform
LPARAMETERS t1, t2, t3
oform = CREATEOBJECT('testform',t1,t2,t3)
oform.show()
return

DEFINE CLASS testform AS form


	ShowWindow = 0
	DoCreate = .T.
	AutoCenter = .F.
	Caption = "Form1"
	WindowType = 1
	WindowState = 0
	Name = "MENUFORM"


	ADD OBJECT command1 AS commandbutton WITH ;
		Top = 84, ;
		Left = 135, ;
		Height = 27, ;
		Width = 120, ;
		Caption = "Close form", ;
		Name = "Command1"


	PROCEDURE Init
		LPARAMETERS trow, tcol,tright
		DODEFAULT()
		IF !tright AND (TYPE('trow') <> "L" AND TYPE('tcol') <> "L")
			this.top = trow
			this.left = tcol
		ELSE
			IF tright AND (TYPE('trow') <> "L" AND TYPE('tcol') <> "L")
				this.top = trow
				this.left = tcol - this.width
			ENDIF
		ENDIF
	ENDPROC

	PROCEDURE command1.click
		thisform.release()
	ENDPROC


ENDDEFINE
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform