-
1. Re: How to create a panel same as this...
Harbs. Sep 26, 2011 6:45 AM (in response to starnight1981)CAN YOU PLEASE NOT SHOUT?
-
2. Re: How to create a panel same as this...
A. Patterson Sep 26, 2011 11:08 AM (in response to starnight1981)I believe the Action & Layers panels use a highly customized ADMHierarchyList control. To get the effect of the two columns on the far left, you have to draw the entire contents of each entry yourself. That would mean handling the clicks (so you'd have to know where the clickable boxes are in each entry), etc.
Personally, I just put any clickable spots on the far right -- much, easier. It let me use a lot of the default drawing behaviour and simplified the math. -
3. Re: How to create a panel same as this...
Meate Sep 26, 2011 12:12 PM (in response to A. Patterson)Mr. Patterson is correct, you'll have to draw it all manually. We have a similar control, and it took a bit of work to get it to draw and respond to interactions correctly.
Basically, you create a Draw proc for the hierarchy list (see ADMHierarchyList->SetDrawProc). This function is called for each item in the list that needs to be drawn. You get the bounds of the item and you draw whatever you want. For example:
void ADMAPI MyDialog::DrawItemProc(ADMListEntryRef entry, ADMDrawerRef drawer)
{
ADMHierarchyListRef hierarchyList = sADMListEntry4->GetList(entry);
// get the bounds of the item to be drawn and color the rectangle white
ADMRect entryBounds;
sADMHierarchyList5->GetEntryTextRect(hierarchyList, &entryBounds);
sADMDrawer->SetADMColor(drawer, kADMWhiteColor);
sADMDrawer->FillRect(drawer, &entryBounds);
// define the area where a first check box will go
ADMRect visibleButton;
visibleButton.top = (entryBounds.bottom - entryBounds.top - 13) / 2;
visibleButton.bottom = visibleButton.top + 13;
visibleButton.left = entryBounds.left + 2;
visibleButton.right = visibleButton.left + 13;
// draw the check box
sADMDrawer->DrawSunkenRect(drawer, &visibleButton);
// etc
}
To respond to a user clicking in the item, you create a Track proc (see ADMHierarchyList->SetTrackProc). In the Track proc you get the bounds of the item and where the mouse is and you can figure out what the user clicked on. For example:
ADMBoolean ADMAPI MyDialog::TrackProc(ADMListEntryRef entry, ADMTrackerRef tracker)
{
ADMHierarchyListRef hierarchyList = sADMListEntry4->GetList(entry);
ADMItemRef entryItem = sADMListEntry4->GetItem(entry);
ADMItemRef hierarchyItem = sADMHierarchyList5->GetItem(hierarchyList);
ADMModifiers modifiers = sADMTracker2->GetModifiers(tracker);
ADMAction action = sADMTracker2->GetAction(tracker);
ADMPoint point;
sADMTracker2->GetPoint(tracker, &point);
ADMRect entryBounds;
sADMHierarchyList5->GetEntryTextRect(hierarchyList, &entryBounds);
// define the area where the check box is
ADMRect visibleButton;
visibleButton.top = (entryBounds.bottom - entryBounds.top - 13) / 2;
visibleButton.bottom = visibleButton.top + 13;
visibleButton.left = entryBounds.left + 2;
visibleButton.right = visibleButton.left + 13;
// check if the mouse is over the check box and was clicked
if (point.h >= visibleButton.left && point.h <= visibleButton.right && point.v >= visibleButton.top && point.v <= visibleButton.bottom) {
if (action == kADMButtonUpAction) {
// do something
}
}
}
-
4. Re: How to create a panel same as this...
starnight1981 Sep 27, 2011 3:47 AM (in response to Harbs.) -
5. Re: How to create a panel same as this...
Harbs. Sep 27, 2011 4:08 AM (in response to starnight1981)Because it makes it very hard to read your posts. Common courtesy...
Harbs
-
6. Re: How to create a panel same as this...
starnight1981 Sep 28, 2011 12:44 AM (in response to Harbs.)Re:Because it makes it very hard to read your posts. Common courtesy...
Harbs
Oh,my english is poor,so I pasted a picture.




