|
VFP 愛用者社區 本討論區為 Visual Foxpro 愛用者經驗交流的地方, 請多多利用"搜尋"的功能, 先查看看有無前例可循, 如果還有不懂的再發問. 部份主題有附加檔案, 須先註冊成為社區居民才可以下載.
|
上一篇主題 :: 下一篇主題 |
發表人 |
內容 |
Batman
註冊時間: 2003-11-15 文章: 348
第 1 樓
|
發表於: 星期二 九月 15, 2015 7:11 pm 文章主題: 如何手動加自定義按鈕在Commandgroup內? |
|
|
建了一個Commandgroup, 因想轉為自定義的CommandButton(祗是轉其中一個按鈕),如第三個按鈕, This.Commandgroup1.RemoveObject('Command3'), 沒問題, 但加上去自定義的按鈕 Mybutton(在MyClass內), 怎樣也不成功, 用Newobject或AddObject也不行, 請狐友幫忙一下, 謝謝 |
|
回頂端 |
|
|
perry
註冊時間: 2014-07-20 文章: 203
第 2 樓
|
發表於: 星期二 九月 15, 2015 8:19 pm 文章主題: |
|
|
在主程式中加入
SET CLASS TO d:\yourpath\MYCLASS ADDI
代碼: |
if vartype(cmd3)#'O'
thisform.commandgroup1.addobject('cmd3','mybutton')
with thisform.commandgroup1.cmd3
.top=thisform.commandgroup1.command2.top+thisform.commandgroup1.command2.height
.visible=.t.
.enabled=.t.
.width=thisform.commandgroup1.command2.width
.left=thisform.commandgroup1.command2.left
endwith
endi
|
|
|
回頂端 |
|
|
Batman
註冊時間: 2003-11-15 文章: 348
第 3 樓
|
發表於: 星期二 九月 15, 2015 8:41 pm 文章主題: |
|
|
謝謝Perry, 我也試到了, 不過看起來有點怪, 是用NewObject
Thisform.Commandgroup1.NewObject('Command1','mybutton','MyClass.vcx')
oCmd=Eval('This.Command1')---->以為Command1已是Object, 估不到又要轉換
....... 不知對不對??
不過是Work的 |
|
回頂端 |
|
|
Batman
註冊時間: 2003-11-15 文章: 348
第 4 樓
|
發表於: 星期日 九月 20, 2015 6:56 pm 文章主題: |
|
|
概念錯了," Thisform.Commandgroup1.NewObject('Command1','mybutton','MyClass.vcx') "的Command1已是Object了,不用再執行 "oCmd=Eval('This.Command1')", 祗是用了oCmd替代 this.Command1, 直接用oCmd=this.Command1便可了....笨笨的 ^^ |
|
回頂端 |
|
|
|
|
您 無法 在這個版面發表文章 您 無法 在這個版面回覆文章 您 無法 在這個版面編輯文章 您 無法 在這個版面刪除文章 您 無法 在這個版面進行投票 您 無法 在這個版面附加檔案 您 無法 在這個版面下載檔案
|
|