As for planting trees, 90% of people will not plant infinite-level trees, and 80% of people will not plant first-level trees.
Today, I will teach you how to plant first-level trees and infinite trees.
Let’s take a look at the background table first. treedata1, id is an auto-incrementing primary key.
1. Make a form
2. Use MSSQLHelper to obtain data in form LOAD
DO setenv LOCAL oDBSQLHelper,nRow,oca & amp; & amp;Member category table TEXT TO lcSQLCmd NOSHOW TEXTMERGE SELECT * FROM treedata1 ENDTEXT oDBSQLHelper=Newobject("MSSQLHelper","MSSQLHelper.prg") nRow=oDBSQLHelper.SQLQuery(lcSQLCmd,"treedata1") IF nRow<1 Messagebox(oDBSQLHelper.errmsg,0 + 16,Thisform.Caption) Return.F. Endif
3. Set form properties
Set the attribute value of the tree control as shown in the figure, displayfield=name, datafield=id
qiyu_treeview control property description
Attribute name | Default | Description |
mainalias | Bound table | |
displayfield | Display field | |
datafield | Bind value field | |
value | Control selected value | |
isdisplaykey | Whether to display the value of the value field | |
fatherfield | Parent field (for multi-level trees) |
The two text box controls can be bound to treedata1.id and treedata1.name respectively.
Donodeclick of qiyu_treeview1 refreshes the form
LPARAMETERS node thisform.Refresh()
Let’s run it again
If the operation is successful, click on any tree node and the control on the right will change.
How to plant infinite trees
Backend table structure minimalist
There is only one more field than the first-level tree
Just set one more fatherkey to fid in the attributes of qiyu_treeview1
The other controls have the same settings, and an additional combo box is added to display the contents of fid.
Combo box settings
Set the combo box to read-only and prevent modification.
The form’s load event loads data
DO setenv LOCAL oDBSQLHelper,nRow,oca & amp; & amp;Member category table TEXT TO lcSQLCmd NOSHOW TEXTMERGE SELECT * FROM treedata ENDTEXT oDBSQLHelper=Newobject("MSSQLHelper","MSSQLHelper.prg") nRow=oDBSQLHelper.SQLQuery(lcSQLCmd,"treedata") IF nRow<1 Messagebox(oDBSQLHelper.errmsg,0 + 16,Thisform.Caption) Return.F. Endif *--For combo box SELECT * FROM treedata INTO CURSOR treedata2
After running it, do you think it is easy to plant trees?
Mao Mao’s inner thoughts
Garfield’s VFP|Fox Friends Club is accepting submissions
Garfield’s VFP, use VFP not limit VFP, use VFP to mix everything. Whether it’s VFP, JS, or C, as long as it can be mixed, it can be published.
Business models, sales skills, demand planning, and product design knowledge can all be published.
The tentative red envelope is 50 yuan for 1,000 words, and the red envelope will be bigger for excellent articles. Once published, the red envelope will be available.
How to help people who use VFP?
People who use VFP include both professionals and non-professionals. Many of them are actually novices and ask questions that are novices. If the questions are wrong, we guide them to ask the right questions. In any case, please don’t laugh at them and say they don’t even look for help. They can’t even answer such a simple question. It’s very low to laugh at others and not be able to come up with constructive answers.
Whether we have work needs or have our own software, we all need real knowledge. How to let more people learn real VFP knowledge? Just like it, watch it, and forward it to friends, it would be even better .
Garfield’s vfp advocates the use of “VFP minimalist hybrid development, writing less code, getting started quickly, using VFP, but not limited to VFP, mixed development of various languages”.
I have led more than a hundred members to successfully master the black technology of VFP and entered the era of mobile Internet. Next, we will enter the field of Internet of Things.
Recruitment of Huyouhui community members in 2023 continues
The benefits obtained by community members include:
Qiyou three-layer development framework commercial version (cat box), lifetime free upgrades, lifetime technical support.
The open recorded and broadcast courses include:
WeChat applet, WeChat public account development, H5 APP development, Extjs BS development, VFP object-oriented advancement, VFP middle layer development.
Source code resources include:
Payment component source code, SMS source code, permission component source code, and some complete system source codes. This can be sold separately, please contact me if you need it.
Members can also connect resources within the group and receive subcontracting, cooperation and other commercial or technical services.
The knowledge points of the article match the official knowledge files, and you can further learn related knowledge. Java Skill TreeHomepageOverview 137270 people are learning the system