|
VFP 愛用者社區 本討論區為 Visual Foxpro 愛用者經驗交流的地方, 請多多利用"搜尋"的功能, 先查看看有無前例可循, 如果還有不懂的再發問. 部份主題有附加檔案, 須先註冊成為社區居民才可以下載.
|
上一篇主題 :: 下一篇主題 |
發表人 |
內容 |
Kuma
註冊時間: 2011-06-22 文章: 39 來自: Taichung
第 1 樓
|
發表於: 星期四 九月 22, 2022 4:01 pm 文章主題: 請教 可抓到 form 內所有 Label 的個數嗎 ? |
|
|
如 :
for i=1 to nLabelCount
ThisForm.nLabelYY.Caption = ' XXXX'
next |
|
回頂端 |
|
|
syntech
註冊時間: 2003-05-16 文章: 4212 來自: Taipei,Taiwan
第 2 樓
|
發表於: 星期四 九月 22, 2022 4:14 pm 文章主題: |
|
|
USE FORM1. SCX
SET FILTER TO BASECLASS = "XXXX"
DO WHILE !EOF()
.....
ENDDO
_________________ 如果公司有下列困擾:
1. 找不到便宜,快速,簡易的 生產排程軟體
2. 不知道如何快速排定 採購計劃
3. 成本抓不準,自己算比軟體算有用
4. 想學習系統規劃,想找系統架構的顧問
請聯絡我們,也許我們幫得上忙 |
|
回頂端 |
|
|
syntech
註冊時間: 2003-05-16 文章: 4212 來自: Taipei,Taiwan
第 3 樓
|
發表於: 星期四 九月 22, 2022 4:28 pm 文章主題: |
|
|
看清楚重點才不會抄錯
代碼: |
for i=1 to thisform.controlcount
with this.controls(i)
IF UPPER(this.controls(i).BASECLASS) = 'XXXXXX'
...............
ENDIF
if upper(this.controls(i).baseclass)='CONTAINER'
for j =1 to this.controls(i).controlcount
if upper(this.controls(i).controls(j).baseclass)='CONTAINER'
for k =1 to this.controls(i).controls(j).controlcount
with this.controls(i).controls(j).controls(k)
if upper(this.controls(i).controls(j).controls(k).class)='xxxxxx'
......
endif
endwith
endfor
endif
if upper(this.controls(i).controls(j).baseclass)='PAGEFRAME'
for k =1 to this.controls(i).controls(j).pagecount
with this.controls(i).controls(j).pages(k)
for l=1 to this.controls(i).controls(j).pages(k).controlcount
with this.controls(i).controls(j).pages(k).controls(l)
if upper(this.controls(i).controls(j).controls(k).controls(l).class)='XXXX'
......
endif
endwith
endfor
endwith
endfor
endif
endfor
endif
endfor
|
_________________ 如果公司有下列困擾:
1. 找不到便宜,快速,簡易的 生產排程軟體
2. 不知道如何快速排定 採購計劃
3. 成本抓不準,自己算比軟體算有用
4. 想學習系統規劃,想找系統架構的顧問
請聯絡我們,也許我們幫得上忙
syntech 在 星期四 九月 22, 2022 8:48 pm 作了第 1 次修改 |
|
回頂端 |
|
|
Kuma
註冊時間: 2011-06-22 文章: 39 來自: Taichung
第 4 樓
|
發表於: 星期四 九月 22, 2022 4:38 pm 文章主題: |
|
|
感恩, 我來試看看. |
|
回頂端 |
|
|
ckp6250
註冊時間: 2004-07-30 文章: 1645
第 5 樓
|
發表於: 星期五 九月 23, 2022 5:22 pm 文章主題: |
|
|
抄錯沒關係,
但要註明出處∼∼ |
|
回頂端 |
|
|
foxy
註冊時間: 2007-08-16 文章: 232 來自: 泰國
第 6 樓
|
發表於: 星期一 九月 26, 2022 11:22 am 文章主題: |
|
|
Label 使用 class, 所有 Label 都屬於同一個 class. 在 class 的 init() 裡面計數放到 thisform 的自定義的 property: nLabelCount:
thisform.nLabelCount=thisform.nLabelCount+1
Form 也要使用 class.
如要更新 所有 Label 的 caption, 也可以直接在 在 class 的 init() 裡面做:
this.caption='YYYY'
如果要翻譯 Label 的 caption, 也可以直接在 class 的 init() 裡面做:
this.caption=translate(this.caption)
使用 class 更加方便.
還可以在 form.init() 裡面呼叫自定義 method: transl()
這個 method 會繼續呼叫自己:
Lparameters lobj
If !Type('lobj')=='O'
IF TYPE('thisformset')='O'
m.lobj=thisformset
else
m.lobj=Thisform
endif
ENDIF
Local fo
fo=.Null.
Do Case
CASE skipTransl4Class(UPPER(m.lobj.class)) && some controls do not need translate caption
RETURN
Case Pemstatus(lobj,'forms',5)
For Each fo In lobj.forms
addGradObject(fo,thisform)
this.transl(fo)
Endfor
Case Pemstatus(lobj,'pages',5)
For Each fo In lobj.pages
setBkColorGrad(m.fo,thisform)
this.transl(m.fo)
Endfor
Case Pemstatus(lobj,'columns',5)
For Each fo In lobj.Columns
this.transl(fo)
ENDFOR
Case Pemstatus(lobj,'buttons',5)
addGradObject(m.lobj,thisform)
For Each fo In lobj.buttons
this.transl(fo)
Endfor
Case lobj.baseclass='Column' && XXXcontrols
*!* SET STEP ON
For Each fo In lobj.controls
this.transl(fo)
ENDFOR
Case Pemstatus(lobj,'controls',5) && put below XXXcontrols, to have column go through transl() too
IF !m.lobj.baseclass='Custom'
addGradObject(m.lobj,thisform)
endif
For Each fo In lobj.Controls
this.transl(fo)
Endfor
ENDCASE
this.transl_tooltip(m.lobj) && translate tooltip
this.transl_caption(m.lobj) && translate caption
this.set_visible(m.lobj) _________________ 進銷存+生產製造+會計+員工薪資+CRM+POS零售+餐廳手機app+電商手機app+電商網站,物流系統. 正/簡體中文,英,日,泰,緬甸文. MS SQL Server + 前台 VFP + PHP 網站 + Flutter 手機 App, 都共享 MS SQL Server的資料. www.foxacc.com LINE: mike-lm |
|
回頂端 |
|
|
小賴
註冊時間: 2004-12-27 文章: 471
第 7 樓
|
發表於: 星期一 九月 26, 2022 12:38 pm 文章主題: |
|
|
TO:FOXY
好方法!
Good ! |
|
回頂端 |
|
|
小賴
註冊時間: 2004-12-27 文章: 471
第 8 樓
|
發表於: 星期一 九月 26, 2022 12:45 pm 文章主題: |
|
|
對樓主來說Foxy兄的方法可能用不上了
樓主form上的Label都放上了;來不急自訂類別了 |
|
回頂端 |
|
|
foxy
註冊時間: 2007-08-16 文章: 232 來自: 泰國
第 9 樓
|
發表於: 星期一 九月 26, 2022 1:46 pm 文章主題: |
|
|
小賴 寫到: | TO:FOXY
好方法!
Good ! |
謝謝您, 小賴 _________________ 進銷存+生產製造+會計+員工薪資+CRM+POS零售+餐廳手機app+電商手機app+電商網站,物流系統. 正/簡體中文,英,日,泰,緬甸文. MS SQL Server + 前台 VFP + PHP 網站 + Flutter 手機 App, 都共享 MS SQL Server的資料. www.foxacc.com LINE: mike-lm |
|
回頂端 |
|
|
foxy
註冊時間: 2007-08-16 文章: 232 來自: 泰國
第 10 樓
|
發表於: 星期一 九月 26, 2022 1:50 pm 文章主題: |
|
|
小賴 寫到: | 對樓主來說Foxy兄的方法可能用不上了
樓主form上的Label都放上了;來不急自訂類別了 |
可以直接更改 class/classloc 欄位 指向新建的 class 就可以了
USE myform.scx
replace class with 'lblclass', classloc with '..\class\myclass.vcx' for baseclass='Label' _________________ 進銷存+生產製造+會計+員工薪資+CRM+POS零售+餐廳手機app+電商手機app+電商網站,物流系統. 正/簡體中文,英,日,泰,緬甸文. MS SQL Server + 前台 VFP + PHP 網站 + Flutter 手機 App, 都共享 MS SQL Server的資料. www.foxacc.com LINE: mike-lm |
|
回頂端 |
|
|
小賴
註冊時間: 2004-12-27 文章: 471
第 11 樓
|
發表於: 星期一 九月 26, 2022 3:48 pm 文章主題: |
|
|
TO FOXY:
了解;應謝指點 |
|
回頂端 |
|
|
|
|
您 無法 在這個版面發表文章 您 無法 在這個版面回覆文章 您 無法 在這個版面編輯文章 您 無法 在這個版面刪除文章 您 無法 在這個版面進行投票 您 無法 在這個版面附加檔案 您 無法 在這個版面下載檔案
|
|