VFP tree planting, one-level tree, infinite level tree, Qiyu_treeview control uses super simple method

2007dad0b6f80cbfc40534f5400ade82.gif

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.

5c769acd09477bfc2b5a8517f15f1d7b.png

1. Make a form

3e75456325b615f391acecca170bfa7f.png

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

b004af404423b34d4683b97cbee19813.png

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

5114916b25c924a0e8fdb7405dfd0f0f.png

LPARAMETERS node
thisform.Refresh()

Let’s run it again

d7eef688c1213f5ca70b24e28a278fcd.png

If the operation is successful, click on any tree node and the control on the right will change.

How to plant infinite trees

1fc213d05a8d6908663bff95a7d44b9d.png

Backend table structure minimalist

There is only one more field than the first-level tree

028a87ea1338dbfed1414b0e75e7e081.png

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.

f70a97d9cc610609f6f703466d5336cb.png

Combo box settings

2f106a9dd084d328ed05679bc602384f.png

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.

67f50bdbecab401be7458b335159c6e0.gif

35cf2d44bb774059401ffbc22f3ba8d2.jpeg

f298c90083859ab54ec7d86aa25ff9f7.gif

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