Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
Tree-View Dragging?

 
Post new topic   Reply to topic Printable version
 View previous topic  Anyone up to some website coding? Post :: Post Opinion on Alphabetic Sort  View next topic  
Author Message
Cyan~Fire
I'll count you!
I'll count you!


Age:30
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Sat Oct 15, 2005 10:51 am    Post subject: Tree-View Dragging? Reply to topic Reply with quote

Wondering if anyone (Ekted) has used a treeview before, and wondering what the heck might be wrong with mine. When I do the click-and-drag thing, I get this:

Basically, it's inverting the color of anything under the dragged item. If it's highlighted, the area is white, and if it's not, the area is blue. And it only happens when the item the cursor is hovering over changes, not when I move back and forth over an item.

Here's my code:
Code: Show/Hide
void TrigTree_HandleDrag(HWND treeview, NMTREEVIEW *params)
{
   HIMAGELIST images;

   /* Do the UI stuff. */
   images = TreeView_CreateDragImage(treeview, params->itemNew.hItem);
   ImageList_BeginDrag(images, 0, 0, 0);
   ImageList_DragEnter(treeview, params->ptDrag.x, params->ptDrag.y);

   /* Do the behind-the-scenes stuff. */
   SetCapture(GetParent(treeview));
   dragging = true;
}
bool HandleMouseMove(HWND dialog, WORD x, WORD y)
{
   TVHITTESTINFO tvht;
   HWND treeview = GetDlgItem(dialog, IDC_T_TREE);

   if (dragging)
   {
      ImageList_DragMove(x, y);

      tvht.pt.x = x;
      tvht.pt.y = y;
      if (TreeView_HitTest(treeview, &tvht))
      {
         TreeView_SelectDropTarget(treeview, tvht.hItem);
      }
   }

   return dragging;
}


Any clues?
_________________
This help is informational only. No representation is made or warranty given as to its content. User assumes all risk of use. Cyan~Fire assumes no responsibility for any loss or delay resulting from such use.
Wise men STILL seek Him.




Evil Painting

evil.png - 10.56 KB
File downloaded or viewed 6 time(s)
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Cyan~Fire
I'll count you!
I'll count you!


Age:30
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Mon Feb 27, 2006 8:12 pm    Post subject: Reply to topic Reply with quote

Stupid, stupid, horrible Win32 API. I finally found the answer when I happened to find a giant book on the API. I looked up treeviews, and there it was: how to properly drag. But here's the modification:
Code: Show/Hide
bool HandleMouseMove(HWND dialog, WORD x, WORD y)
{
...
      if (TreeView_HitTest(treeview, &tvht) &&
         tvht.flags & (TVHT_ONITEM | TVHT_ONITEMRIGHT))
      {
         ImageList_DragShowNolock(FALSE);
         TreeView_SelectDropTarget(treeview, tvht.hItem);
         ImageList_DragShowNolock(TRUE);
      }
...
}

Turns out if you don't turn off the drag image (with ImageList_DragShowNolock()) while the treeview's painting the drop-target highlight, it image interferes. Of course, the MSDN documentation doesn't say a word about this.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Mon Feb 27, 2006 11:05 pm    Post subject: Reply to topic Reply with quote

Never used one before. Thanks for the info. icon_smile.gif
_________________
4,691 irradiated haggis!
Back to top
View users profile Send private message Add User to Ignore List
Solo Ace
Yeah, I'm in touch with reality...we correspond from time to time.


Age:31
Gender:Gender:Male
Joined: Feb 06 2004
Posts: 2583
Location: The Netherlands
Offline

PostPosted: Mon Mar 06, 2006 1:46 am    Post subject: Reply to topic Reply with quote

Heh, speaking of a horrible Win32 API. Yesterday I was trying to figure out how to add a check box control (to the first, left column) to an entry in a ListView.
I couldn't get it to work, eventually I gave up heh.
Adding an icon there works fine, though. icon_sad.gif

Any of you ever did this?

BTW, Cyan, I love your *cough* meaningless *cough* comments. sa_tongue.gif
Back to top
View users profile Send private message Add User to Ignore List
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Mon Mar 06, 2006 2:37 am    Post subject: Reply to topic Reply with quote

There's no standard way to do it. Windows doesn't have a "checkbox in list" type of standard control. However it is done all the time. I'm sure you could find examples if you google the right keywords. If you find something, I can probably help you undertand it.
Back to top
View users profile Send private message Add User to Ignore List
Solo Ace
Yeah, I'm in touch with reality...we correspond from time to time.


Age:31
Gender:Gender:Male
Joined: Feb 06 2004
Posts: 2583
Location: The Netherlands
Offline

PostPosted: Mon Mar 06, 2006 12:04 pm    Post subject: Reply to topic Reply with quote

Thanks, but I think it's something for later.
It's for a project for my dad, he said "all entries would be checked anyway", but I refuse to let the idea go!
Back to top
View users profile Send private message Add User to Ignore List
Cyan~Fire
I'll count you!
I'll count you!


Age:30
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Mon Mar 06, 2006 6:48 pm    Post subject: Reply to topic Reply with quote

LVS_EX_CHECKBOXES?
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> Non-Subspace Related Coding All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 157 page(s) served in previous 5 minutes.

phpBB Created this page in 0.087512 seconds : 33 queries executed (59.9%): GZIP compression disabled