Гость
Целевая тема:
Создать новую тему:
Автор:
Форумы / FoxPro, Visual FoxPro [игнор отключен] [закрыт для гостей] / Anchor для Container-а в столбце грида / 3 сообщений из 3, страница 1 из 1
31.01.2008, 16:22
    #35101316
shanton
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Anchor для Container-а в столбце грида
Есть контейнер cnt_grd, в котором находится два обьекта: textbox и commandbox. Этот контейнер я помещаю в столбец, как стандартный контейнер грида. Нужно чтобы во время изменения размеров столбца, изменялись размер и положение контейнера cnt_grd и его обьектов. Ставлю cnt_grd.Anchor = 10; cnt_grd.textbox.Anchor = 10; cnt_grd.Commandbox.Anchor = 8, но ничего не происходит. Как заставить контейнер и его обьекты изменять размер и положение, в зависимости от изменения размеров столбца, в котором они находятся? Большое спасибо!
...
Рейтинг: 0 / 0
31.01.2008, 18:28
    #35101829
прошелмимо
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Anchor для Container-а в столбце грида
...
Рейтинг: 0 / 0
31.01.2008, 20:01
    #35102052
прошелмимо
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Anchor для Container-а в столбце грида
+ репрокод, подсмотрите для себя ресайз контролов

Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
126.
127.
128.
129.
130.
131.
132.
133.
134.
135.
136.
137.
138.
139.
140.
141.
142.
143.
144.
145.
146.
147.
148.
149.
150.
151.
152.
153.
154.
155.
156.
157.
158.
159.
160.
161.
162.
163.
164.
165.
166.
167.
168.
169.
170.
171.
172.
173.
174.
175.
176.
177.
178.
179.
180.
181.
182.
183.
184.
185.
186.
187.
188.
189.
190.
191.
192.
DEFINE CLASS state AS control


	Width =  76 
	Height =  21 
	BackStyle =  0 
	BorderWidth =  0 
	Style =  3 
	nwidth =  0 
	nheight =  0 
	nrow =  0 
	ncol =  0 
	Name = "state"
	ogrid = .F.
	nrowheightold = .F.
	calias = .F.
	cpopup = .F.
	llockbar1 = .F.
	llockbar2 = .F.
	llockbar3 = .F.
	llockbar4 = .F.


	ADD OBJECT lbl AS label WITH ;
		BackStyle =  0 , ;
		Caption = "", ;
		Height =  17 , ;
		Left =  5 , ;
		Top =  3 , ;
		Width =  66 , ;
		Name = "lbl"


	ADD OBJECT lbl_lock AS label WITH ;
		FontName = "Courier New", ;
		FontSize =  7 , ;
		BackStyle =  0 , ;
		Caption = "заблокирован", ;
		Height =  13 , ;
		Left =  1 , ;
		Top = - 2 , ;
		Visible = .F., ;
		Width =  74 , ;
		Name = "Lbl_lock"


	ADD OBJECT cmd AS commandbutton WITH ;
		Top =  1 , ;
		Left =  59 , ;
		Height =  20 , ;
		Width =  18 , ;
		FontName = "Webdings", ;
		Caption = "6", ;
		SpecialEffect =  1 , ;
		Themes = .F., ;
		Name = "cmd"


	PROCEDURE nheight_assign
		LPARAMETERS tnNewVal
		store tnNewVal to this.nHeight, this.Height
		return .t.
	ENDPROC


	PROCEDURE nwidth_assign
		LPARAMETERS tnNewVal
		store tnNewVal to this.nWidth, this.Width
		return .t.
	ENDPROC


	PROCEDURE eventgridmousedown
		lparameters nButton, nShift, nXCoord, nYCoord
		if nButton= 1  and vartype(this.oGrid)="O"
			this.nRowHeightOld=this.oGrid.RowHeight
		endif
	ENDPROC


	PROCEDURE eventgridmouseup
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		with this 
			IF vartype(this.oGrid)="O" and .nRowHeightOld<>.oGrid.RowHeight
				.resize()
			endif
		endwith
	ENDPROC


	PROCEDURE definepopup
		local lcPopup
		with this
			if empty(this.cPopup)
				store "PopObjState"+sys( 2015 ) to lcPopup, .cPopup
			else
				store .cPopup to lcPopup
			endif
			DEFINE popup (lcPopup) SHORTCUT RELATIVE FROM MROW(),MCOL()
			Define BAR  1  OF (lcPopup) prompt iif(.lLockBar1,"\", "") + "1"  
			Define BAR  2  OF (lcPopup) prompt iif(.lLockBar2,"\","\") + "2"
			Define BAR  3  OF (lcPopup) prompt iif(.lLockBar3,"\", "\") + "3"  
			Define BAR  4  OF (lcPopup) prompt iif(.lLockBar3,"\", "") + "4"  
			Define BAR  5  OF (lcPopup) prompt iif(.lLockBar4,"\", "") + "5" 
			on selection popup (lcPopup) deactivate popup (lcPopup)
		endwith
	ENDPROC


	PROCEDURE activatepopup
		mouse at objtoclient(this, 1 )+objtoclient(this, 4 ),objtoclient(this, 2 )+objtoclient(this, 3 ) pixels window (thisform.name)
		doevents
		local lcPopup, lnActiveBar
		lcPopup = this.cPopup
		this.nRow = mrow("SCREEN")-wlrow()- 2 
		this.nCol = mcol("SCREEN")-wlcol()- 1 
		select (thisform.alias)
		if lower(alltrim(AN_SNAME))== lower(alltrim(thisform.cAnalitConfirmed))
			lnActiveBar =  4 
		else
			lnActiveBar = icase(obr= 0 ,  1 , obr= 1 ,  2 , obr= 2 ,  3 ,  1 ) 
		endif
		activate popup (lcPopup) at this.nRow, this.nCol bar lnActiveBar
		return iif(lastkey()= 13 ,bar(), 0 )
	ENDPROC


	PROCEDURE Init
		With This
			If Vartype(.Parent)='O'
				store .parent.parent.backcolor to .cmd.backcolor
				local loColumn
				loColumn = This.Parent
				.oGrid = loColumn.Parent
				.cAlias = .oGrid.recordSource
				.definePopup()
				bindevent(loColumn,'Resize',this,'Resize', 1 )
				bindevent(.oGrid,'MouseDown',this,'EventGridMouseDown', 1 )
				bindevent(.oGrid,'MouseUp',this,'EventGridMouseUp', 1 )
				.Resize(loColumn)
			Endif
		Endwith
	ENDPROC


	PROCEDURE Resize
		Lparameters toColumn
		With This
			If Vartype(toColumn)<>'O'
				store .Parent to toColumn
			endif 
			If .nWidth<>toColumn.Width or .nHeight<>toColumn.Parent.RowHeight
				.nWidth  		= toColumn.Width
				store toColumn.Parent.RowHeight to .nRowHeightOld, .nHeight
				.cmd.Height 	= .nHeight- 2 
				.cmd.Left   	= .nWidth - .cmd.Width
				.lbl.Width 		= .nWidth
				.lbl.Top   		= (.nHeight - .lbl.Height)/ 2 
				toColumn.refresh()
			Endif
		Endwith
	ENDPROC


	PROCEDURE Destroy
		with this
			.oGrid = .f.
			if !empty(.cPopup)
				release popups (.cPopup)
			endif
		endwith
	ENDPROC


	PROCEDURE DblClick
		with this.cmd
			if .enabled
				.click()
			endif
		endwith
	ENDPROC


	PROCEDURE lbl.DblClick
		this.Parent.DblClick()
	ENDPROC


	PROCEDURE cmd.Click
	ENDPROC


ENDDEFINE
...
Рейтинг: 0 / 0
Форумы / FoxPro, Visual FoxPro [игнор отключен] [закрыт для гостей] / Anchor для Container-а в столбце грида / 3 сообщений из 3, страница 1 из 1
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]