惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 叶小钗
云风的 BLOG
云风的 BLOG
G
Google Developers Blog
S
SegmentFault 最新的问题
罗磊的独立博客
Hugging Face - Blog
Hugging Face - Blog
美团技术团队
爱范儿
爱范儿
博客园 - 三生石上(FineUI控件)
H
Hackread – Cybersecurity News, Data Breaches, AI and More
D
DataBreaches.Net
F
Fortinet All Blogs
TaoSecurity Blog
TaoSecurity Blog
D
Docker
C
Cybersecurity and Infrastructure Security Agency CISA
K
Kaspersky official blog
宝玉的分享
宝玉的分享
腾讯CDC
Google Online Security Blog
Google Online Security Blog
Recorded Future
Recorded Future
T
The Exploit Database - CXSecurity.com
T
The Blog of Author Tim Ferriss
V
V2EX
S
Securelist
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
C
CERT Recently Published Vulnerability Notes
A
Arctic Wolf
Scott Helme
Scott Helme
L
LINUX DO - 热门话题
Y
Y Combinator Blog
P
Proofpoint News Feed
T
Tor Project blog
AWS News Blog
AWS News Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
The Last Watchdog
The Last Watchdog
博客园 - 聂微东
T
Threat Research - Cisco Blogs
B
Blog
Attack and Defense Labs
Attack and Defense Labs
L
Lohrmann on Cybersecurity
C
CXSECURITY Database RSS Feed - CXSecurity.com
阮一峰的网络日志
阮一峰的网络日志
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
IT之家
IT之家
N
News and Events Feed by Topic
博客园 - 司徒正美
H
Help Net Security
C
Cisco Blogs
C
Check Point Blog
S
Secure Thoughts

博客园 - max chan

企业管理软件开发XP iframe 高度自动调节,最简单解决 被逼上 Visual Studio 2008 被逼上 visual studio 2005 超级gnFindWindow FLL - C++与VFP 双向混合编程 C++ 松花江上 复习 树-递归 全面自定义 - 代码挂接 设计原则 聪明与代价 VFP程序,全面自定义之表单/类 VFP通用代码(vcx/scx/prg)混淆器,可以下载了 备份策略 死里逃生 先舍后得 VFP -> dot net 过渡 -- foxpro toolkit for dot net VFP与DOT NET之间的过渡 - SEDNA
函数glDefinePopup(),动态定义多级的popup菜单
max chan · 2007-08-30 · via 博客园 - max chan

动态的定义POPUP,涉及字符串处理、递归、菜单定义语句等等。

也挺费劲的,

做出这个函数,就可扩展基类 _FORM, 以加上 接口:_c菜单定义 、_v菜单事件() 。  

(1) 使用例子

TEXT to cMenu 
文件
    打开
        EXCEL
        WORD
    关闭
    Quit
    
编辑
    Copy
    paste
帮助    
ENDTEXT

glDefinePopup(cMenu,

'abc')    
Activate Popup abc

(2)函数定义

*******************************************************************
Function glDefinePopup
Lparameters tcPopupDefine, tcPopupName 
*- 功能: 定义多级的关联popup菜单
*-
*- 参数
*- (1) tcPopupDefine: 菜单定义字符串,每项以换行分隔,以TAB确定级别
*- 例子: 
*- text to cPpDefine
*-    文件
*-        打开
*-            EXCEL
*-            WORD
*-        关闭
*- endtext
*-
*- (2) tcPopupName: 定出来的POPUP的名字
*-
Local i,cLine,n当前级数,n上级id_

Release POPUPS (tcPopupName) extended 

*- 转变为链表结构 ----------------
Create Cursor _csDefine_menu_MenuStru (id_ i , fid_ i , 菜单定义 c(
240), 级数 i,子女数 i )
For i=1 to GetWordCount(tcPopupDefine,Chr(13))
    cLine 
= Alltrim( GetWordNum(tcPopupDefine,i,Chr(13)) , 1Chr(10),Chr(32))
    
If Empty(cLine)
        
Loop
    EndIf 
    n当前级数 
=  _n求级数(cLine) 

    n上级id_
=0
    
Do while not bof() && 往回找,找到级别比自己小[1级]的, 就是父. 取其id作fid_, 父的子女数+1
        
If 级数 < n当前级数
            n上级id_ 
=  id_
            
Replace 子女数 with 子女数+1
            
Exit
        EndIf         
        Skip 
-1
    EndDo 
    
    Append Blank 
    
Replace id_ with i, fid_ with n上级id_, 级数 with n当前级数, 菜单定义 with Ltrim(cLine,1,Chr(9)) 
Next 

_vDefinePopUp(
0,0,tcPopupName)
Return .t.
**********************************************
Function _vDefinePopup
Lparameters tn上级id, tn上级barID, tc上级popUp名
Local nBarCnt,nRecNo,c本级popup名

    
If tn上级barID = 0
    c本级popup名 
= tc上级popUp名
Else
    c本级popup名 
= tc上级popUp名+'_'+Alltrim(Str(tn上级barID,10))
    _vfp.DoCmd( Textmerge('On Bar <<tn上级barID>> of <<tc上级popUp名>> activate popup <<c本级popup名>>'))
EndIf     
_vfp.DoCmd( Textmerge(
"Define Popup <<c本级popup名>> shortcut relative "))
_vfp.DoCmd( Textmerge(
"On Selection Popup <<c本级popup名>> Deactivate Popup <<c本级popup名>> "))
*---

nBarCnt
=0
nRecNo
=Recno()
Scan 
for fid_ = tn上级id
    nBarCnt 
= nBarCnt + 1 
    _vfp.DoCmd( Textmerge(
"define Bar <<nBarCnt>>  of <<c本级popup名>> prompt '<<Trim(菜单定义)>>' " ))
    
    
If 子女数 > 0
        _vDefinePopup(id_,nBarCnt,c本级popup名)
    EndIf     
EndScan 
Go (nRecNo)
Return 

**********************************************
Function _n求级数
Lparameters tcStr
Local nCnt,i
nCnt
=0
For i=1 To Len(tcStr)
    
If Substr(tcStr,i,1)=Chr(9)
        nCnt 
= nCnt + 1
    
Else
        
Exit
    Endif
Next

Return nCnt+1
**********************************************************