|
VFP 愛用者社區 本討論區為 Visual Foxpro 愛用者經驗交流的地方, 請多多利用"搜尋"的功能, 先查看看有無前例可循, 如果還有不懂的再發問. 部份主題有附加檔案, 須先註冊成為社區居民才可以下載.
|
上一篇主題 :: 下一篇主題 |
發表人 |
內容 |
Batman
註冊時間: 2003-11-15 文章: 348
第 1 樓
|
發表於: 星期二 十一月 17, 2015 1:56 pm 文章主題: Column下Container內Textbox的 Controlsource, 顯示合併欄位不成功 |
|
|
想在Column下Container內Textbox的 Controlsource 顯示合併欄,如Field1+Field2,Column的Controlsource是可以, 但改至Column內Container的Textbox的ControlSource便不成功, 用變數如Col=Field1+Field2,Column.Container1.Textbox.ControlSource=Col, 卻祗是顯示Cursor的第一行, 又是不成功, 希望狐友幫幫忙解決.
(非必要不想再Select 多一次來建立合併欄位的Cursor) |
|
回頂端 |
|
|
perry
註冊時間: 2014-07-20 文章: 203
第 2 樓
|
發表於: 星期二 十一月 17, 2015 3:01 pm 文章主題: |
|
|
若僅是顯示用試試下面這個方法
col='field1+field2'
Column.Container1.Textbox.ControlSource=&Col |
|
回頂端 |
|
|
Batman
註冊時間: 2003-11-15 文章: 348
第 3 樓
|
發表於: 星期二 十一月 17, 2015 6:02 pm 文章主題: |
|
|
之前也試了, 是不行的, 出現語法錯誤 |
|
回頂端 |
|
|
perry
註冊時間: 2014-07-20 文章: 203
第 4 樓
|
發表於: 星期二 十一月 17, 2015 6:19 pm 文章主題: |
|
|
在表單中僅建立 Grid 物件,其他均在 Grid 的 Init Event 中設定!!
以下是個人Grid 部份的簡單設定,沒大大您那麼複雜!!
代碼: |
WITH THIS.Column1
.ControlSource='IIF(SEEK(IIF(EMPT(iop3),iop1+SPAC(4),iop1+iop2+SPAC(2)),(user_db1)),ALLT(&user_db1->iopname),SPAC(20))+"-"+iopname'
.ReadOnly=.T.
.Sparse=.F.
.Header1.FontName=ft_name
.Header1.FontSize=ft_size
.Header1.Caption='作 業 項 目'
.Width=42*ft_width+2
.FontName=ft_name
.FontSize=ft_size
ENDWITH
WITH THIS.Column2
.Bound=.T.
.FontName=ft_name
.FontSize=ft_size
.ControlSource='io1'
.Sparse=.F.
.Header1.Caption='新增'
.Header1.FontName=ft_name
.Header1.FontSize=ft_size
.Width=5*ft_width+2
.ADDOBJECT('Check2','CheckBox')
*.Check2.ControlSource='IIF(addtf,io1,.F.)'
.Check2.Caption=''
.Check2.VISIBLE=.T.
.Check2.VALUE=io1
.CurrentControl='Check2'
ENDWITH
|
|
|
回頂端 |
|
|
oldbb
註冊時間: 2007-02-28 文章: 83
第 5 樓
|
發表於: 星期三 十一月 18, 2015 8:48 am 文章主題: |
|
|
** Test.prg
CREATE CURSOR dd (ff I, f1 I, f2 I)
FOR i = 1 TO 100
INSERT INTO dd VALUES (0, i,i*2)
ENDFOR
GO TOP
of = CREATEOBJECT("_Form")
of.Show(1)
DEFINE CLASS _Form as Form
ADD OBJECT Grid1 AS _Grid
ENDDEFINE
DEFINE CLASS _Grid as Grid
Visible = .T.
PROCEDURE Init
this.Column1.RemoveObject("Text1")
this.Column1.AddObject("Container1", "_Container")
this.Column1.Sparse = .F.
this.Column1.Container1.Width = this.Column1.Width
this.Column1.Container1.Height = this.RowHeight
this.Column1.Container1.Text1.Width = this.Column1.Width
this.Column1.Container1.Text1.Height = this.RowHeight
ENDPROC
ENDDEFINE
DEFINE CLASS _Container as Container
Visible = .T.
BorderStyle = 0
ADD OBJECT Text1 as _TextBox
ENDDEFINE
DEFINE CLASS _TextBox as TextBox
Visible = .T.
BorderStyle = 0
ControlSource = "dd.f1 + dd.f2"
ENDDEFINE |
|
回頂端 |
|
|
Batman
註冊時間: 2003-11-15 文章: 348
第 6 樓
|
發表於: 星期三 十一月 18, 2015 12:12 pm 文章主題: |
|
|
謝謝兩位狐友幫助, 立即研究, 參看2位的程式碼, 相信問題會解決 |
|
回頂端 |
|
|
|
|
您 無法 在這個版面發表文章 您 無法 在這個版面回覆文章 您 無法 在這個版面編輯文章 您 無法 在這個版面刪除文章 您 無法 在這個版面進行投票 您 無法 在這個版面附加檔案 您 無法 在這個版面下載檔案
|
|