|
Server Help Community forums for Subgame, ASSS, and bots
|
Author |
Message |
Cyan~Fire I'll count you!
Age:36 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Sat Oct 15, 2005 10:51 am Post subject: Tree-View Dragging? |
|
|
|
|
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:
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 26 time(s)
|
|
Back to top |
|
|
Cyan~Fire I'll count you!
Age:36 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Mon Feb 27, 2006 8:12 pm Post subject: |
|
|
|
|
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:
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 |
|
|
Mr Ekted Movie Geek
Gender: Joined: Feb 09 2004 Posts: 1379 Offline
|
Posted: Mon Feb 27, 2006 11:05 pm Post subject: |
|
|
|
|
Never used one before. Thanks for the info. _________________ 4,691 irradiated haggis!
|
|
Back to top |
|
|
Solo Ace Yeah, I'm in touch with reality...we correspond from time to time.
Age:36 Gender: Joined: Feb 06 2004 Posts: 2583 Location: The Netherlands Offline
|
Posted: Mon Mar 06, 2006 1:46 am Post subject: |
|
|
|
|
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.
Any of you ever did this?
BTW, Cyan, I love your *cough* meaningless *cough* comments.
|
|
Back to top |
|
|
Mr Ekted Movie Geek
Gender: Joined: Feb 09 2004 Posts: 1379 Offline
|
Posted: Mon Mar 06, 2006 2:37 am Post subject: |
|
|
|
|
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 |
|
|
Solo Ace Yeah, I'm in touch with reality...we correspond from time to time.
Age:36 Gender: Joined: Feb 06 2004 Posts: 2583 Location: The Netherlands Offline
|
Posted: Mon Mar 06, 2006 12:04 pm Post subject: |
|
|
|
|
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 |
|
|
Cyan~Fire I'll count you!
Age:36 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Mon Mar 06, 2006 6:48 pm Post subject: |
|
|
|
|
LVS_EX_CHECKBOXES?
|
|
Back to top |
|
|
|
|
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
|
Software by php BB © php BB Group Server Load: 719 page(s) served in previous 5 minutes.
|