I finally found the answer to this problem, and quite by accident!
My code was indeed correct but a line I added to fully expand the TreeView
and which came after my in-code selection of the node, actually caused it to
be unselected again!  I would never have considered something like this, but
discovered it while moving some of my code around in an effort to refactor a
bit more.

from Robert Meek dba "Tangentals Design"
e-mail: [EMAIL PROTECTED]
Freelance Windows Programming for XP and Vista 
Also proud to be a Moderator of the "Delphi-List" at elists.org

"Reality cannot be explained...only enjoyed or endured as your current
perspective allows!"

        I'm using the JvDBTreeView component from the Jedi project once
again in a project and I've come to a problem I've never had to deal with
before.
And though it might seem at first to be a dB problem, it really isn't, so
that's why I'm asking here!
        I've used this control before with a database connection that stores
all the nodes, names, Icons, etc., but for the first time I now need to
select a node in code.  
        If I use the mouse and/or keyboard to move from one node to another,
it automatically finds the database table fields it represents and moves the
database cursor to it.  But in this new situation, I have to use a FindKey
to move to the wanted record in the database and I need the TreeView to
select the node representing this record and change its imageindex so it
appears selected the same way it would had I actually clicked on it.  
        I've tried using the OnGetSelectedIndex and OnGetImageIndex events
in a variety of ways, but it seems that what my basic problem is, is that I
am not able to figure out how to select the correct node!  If I could do
that, I believe the ImageIndex would be updated automatically.  But I can't
seem to find a relationship between the nodes and the record values in the
table when going in this direction.  I can get the Nodes's name as
displayed, the Node's IDNumber, and its Parent Node's ID Number and name.  I
thought the Node's Index would be equal to the NodeIDNumber of the record I
move to but it doesn't seem to work.  And I even tried iterating thru the
entire tree looking for each Node's Item text property thinking that it
would be the same as the name being displayed, but apparently not as that
hasn't worked either!  
        I know I'm missing something simple, but the component has no
documentation and no one at jedi knows the answer either.  Any ideas are
appreaciated.      


from Robert Meek dba "Tangentals Design"
e-mail: [EMAIL PROTECTED]
Freelance Windows Programming for XP and Vista 
Also proud to be a Moderator of the "Delphi-List" at elists.org

"Reality cannot be explained...only enjoyed or endured as your current
perspective allows!"


_______________________________________________
Delphi mailing list -> [email protected]
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi

_______________________________________________
Delphi mailing list -> [email protected]
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi

Reply via email to