LB Booster
« LBW-created Tree View »

Welcome Guest. Please Login or Register.
Apr 1st, 2018, 04:39am



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
We apologize Conforums does not have any export functions to migrate data.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

Thank you Conforums members.
Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
LB Booster Resources
LB Booster documentation
LB Booster Home Page
LB Booster technical Wiki
Just BASIC forum
BBC BASIC Home Page
Liberty BASIC forum (the original)

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: LBW-created Tree View  (Read 294 times)
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx LBW-created Tree View
« Thread started on: Apr 10th, 2015, 08:44am »

If you use Liberty BASIC Workshop to create the outline code for a Tree View, it incorporates a SUB treeview1Click which is documented thus: "You must SendMessageA for each node ID to see if it is selected". The implication is that if you have a large tree, with maybe hundreds or thousands of nodes, you must cycle through every node ID checking to see if it is selected (clicked) or not.

In fact there's a much easier method. You can directly ask the Tree View control which node is currently selected; this is just a single message, however large the tree is:

Code:
Sub TreeViewClick
    calldll #user32, "SendMessageA", hwndTreeView1 as ulong, _
      _TVM_GETNEXTITEM as long, _TVGN_CARET as long, _
      0 as long, sel as long
    if sel <> SelectedNode then
      SelectedNode = sel
      notice "Clicked node ";sel
    end if
End Sub 

You would typically call this SUB from a timer. The variable SelectedNode must be declared as a GLOBAL for the click-detection to work.

Richard.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls