SPONSORS:






User Tag List

Results 1 to 6 of 6
  1. #1
    Junior Member
    Join Date
    Aug 2001
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Trouble with Trees

    I'm having trouble getting silktest to "grab" an element in an OLETreeView in a VB6 application. I can select an element in the tree and then I would like to click on it and drag it into another tree control.

    Select actually highlights the node, but it does not actually pass control to the element.

    I tried to use the GetItemRect method to get the coordinates of the highlighted element, but those coordinates don't correspond to the coordinates I need to use for the click method. The GetItemRect coordinates seem to give it's location relative to the entire tree (including the off-screen portion of the tree) and the click method wants coordinates relative to the visible frame on the screen.

    I have searched this forum as well as Segue's site and I haven't found anything that directly addresses what I am trying to do. Any help would be appreciated.

    Gerry

    ------------------

  2. #2
    Senior Member
    Join Date
    Jul 1999
    Location
    Bellingham, WA USA
    Posts
    1,323
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Trouble with Trees

    Glynch,

    My situation does not parallel yours exactly, but I had a very similar problem in a Java Application. I needed to grab a selected node from one treeview, drag it and drop it on another treeview at a specified location.

    The key for me was to forget the BeginDrag and EndDrag methods in favor of the BeginDragAt and EndDragAt methods. These, of course require coordinates.

    As you did, I used the RECT approach to determine exactly where the upper left corner of my node was. The coordinates I got were relative to the treeview rectangle, so screen resolution did not matter. Once I had the RECT of my node and the drop point, I added 5 pixels to the x,y coordinates of each to guarantee I was actually "in" the spot I wanted to be.

    If you can work around your RECT issue this may help.

    ------------------

  3. #3
    Senior Member
    Join Date
    Jul 2001
    Location
    Elizabeth, CO, USA
    Posts
    653
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Trouble with Trees

    If the Select method works correctly -- and it sounds as if it does -- you can use the Cursor class to grab the current coordinates of the object in order to start your BeginDragAt as DJGray suggested.

    Something like...
    I haven't tried the above...just "scribbled" it down here. My math may be wrong to calculate where the x and Y position are in the TreeView object. (May need more coffee.)

    I hope this helps.

    - Dave


    ------------------
    Amelior Technology
    dreed@ameliortech.com
    WaltzingRhino.com
    A concerned Borland customer, a fly in the ointment, a wrench in the works.

  4. #4
    Member
    Join Date
    May 2001
    Location
    Rochester, NY, USA
    Posts
    61
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Trouble with Trees

    When a select on a OLETreeView occurs, the cursor does not actually move to the item, the item just has it's 'selected' property set to TRUE (I.E.: this._SetItemProp ("Nodes", 0, iItem, "Selected", TRUE)). The only thing that I can think of that might work is determining which item is highlighted and thus possibly returning a coordinate based upon that. Anyone have any info on returning that?

    Steven Blunt
    Software Automation Technical Lead

    ------------------
    Steven P. Blunt
    Software Automation Technical Lead
    NASG Sales Force Productivity

  5. #5
    Junior Member
    Join Date
    Aug 2001
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Trouble with Trees

    Thanks to DCreed for pointing in the direction that led to a solution for the tree of origin (OLETreeView). Our solution was different but your suggestion redirected our thinking.

    I am now having a problem with a SSOLETree which is the destination tree for my drag operation. I can't get it to recognize any named elements using any of the methods I want to use. I can perform method operations with frame coordinates but I need this to be data driven and obviously an element's coordinates are values that constantly change.

    ------------------

  6. #6
    Senior Member
    Join Date
    Jul 1999
    Location
    Bellingham, WA USA
    Posts
    1,323
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Trouble with Trees

    Steven,

    Yes, you can get the "Selected Text" as well as the "Selected Index."

    -or-

    - or -

    ...something along that line...

    ------------------


    [This message has been edited by DJGray (edited 10-17-2001).]

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 03:47 AM.

Copyright BetaSoft Inc.