Forum
Please
Log In
to post a new message or reply to an existing one. If you are not registered, please
register.
NOTE: Some forums may be read-only if you are not currently subscribed to
our technical support services.
Subject |
Author |
Date |
|
sehyun park
|
Sep 3, 2007 - 8:49 AM
|
HI
Tabbed control bar position of the child frame(samples "MDI_DynamicInnerOuterBars") is always before the View. How can i change the tab position. I would like to put the tabbed control bar after View bar like as outer dynamic bar.
Thanks
|
|
Technical Support
|
Sep 3, 2007 - 11:48 AM
|
We guess you are talking about dynamic control bars (CExtDynamicControlBar ) in an SDI frame window or an MDI child frame window with a tab page container inside. They are really become added at the beginning of the tab page container. To change this behavior you should use a CExtDynamicControlBar -derived class which implements the CExtDynamicControlBar::OnMoveChildToDocument() virtual method. Just copy the body of the original method and replace the following lines: int nPageIdx = 0;
//int nPageIdx = pWndTabPageContainer->PageGetCount(); with //int nPageIdx = 0;
int nPageIdx = pWndTabPageContainer->PageGetCount();
|
|
sehyun park
|
Sep 3, 2007 - 7:03 PM
|
|
|
tera t
|
Sep 3, 2007 - 2:14 AM
|
Hello.
For realization of a copy & paste function. I want to judge Insert+Shift to be it in a grid.
Should I use OnGbwAnalyzeCellKeyEvent? In addition, I memorize the key input that has been sent continually and should judge it to be it?
|
|
Technical Support
|
Sep 3, 2007 - 12:42 PM
|
You can override the OnGbwAnalyzeCellKeyEvent() for the entire grid or the CExtGridCell::OnKey() for a particular cell.
|
|
tera t
|
Sep 3, 2007 - 12:04 AM
|
Hi
CExtWRB < CExtEdit > An afterimage remains even if I use this order. Will a set point of a property be bad?
|
|
Technical Support
|
Sep 3, 2007 - 1:24 PM
|
Could you clarify your question with some screenshots so we can better understand what you mean?
|
|
tera t
|
Sep 7, 2007 - 2:40 AM
|
Hello.
An afterimage remains in "a line". Why will such a phenomenon occur?
ttp://profuis0.tripod.com/20070907/image02.jpg ttp://profuis0.tripod.com/20070907/SampleMuEdit.lzh
|
|
Technical Support
|
Sep 7, 2007 - 5:43 AM
|
You should not use the CExtWRB template with CExtEdit . If you need an edit control with a thin solid border, you can achieve that with a CExtFlatEdit class which you can find in the Prof-UIS_Controls sample.
|
|
tera t
|
Sep 2, 2007 - 11:46 PM
|
Q1,
Because a border of Grid was hard to find, I tried to use CExtWRB. Scroll bar of Grid disappeared, and it was assumed that I used WRB. Will not there be a good method?
|
|
Technical Support
|
Sep 3, 2007 - 1:24 PM
|
You should not use the CExtWRB template class with the controls which have scroll bars. The CExtWRB template class re-computes and re-paints window non-client area making it looking like a thin 1 pixel border. But scroll bars of the tree control are not scroll bar windows. Thay are rather parts of the window non-client area and they are not based on HWND handles. So, the CExtWRB template class simply kills scroll bars.
The CExtWRB template class is designed for non-scrollable windows like CExtResizableDialog .
If you want to implement a thin border in the scrollable windows you can use the CProfStudioThinFrame class from the ProfStudio sample. This class does not modify the non-client area. It is a standalone window that has its own thin border. The CProfStudioThinFrame class is designed to be a container for another window. This child window is automatically resized to fit all the inner area of the CProfStudioThinFrame window. So, this implementation of the thin border does not affect the scroll bars in its child window. To use it with windows inside the resizable control bar, create a resizable control bar (the m_wndBar in the code snippet below, created in part A) and its child window (the m_wndInside in the code snippet below, created in part B). After that, you should create a CProfStudioThinFrame container (created in part C) with the window in the resizable bar (m_wndInside ): if( // PART A
(! m_wndBar.Create(
_T("My resizable bar caption"),
this,
ID_VIEW_MY_RESIZABLE_BAR
) )
// PART B
|| (! m_wndInside.Create(
. . .
&m_wndBar,
. . .
) )
// PART C
|| (! (new CProfStudioThinFrame)->
CreateDynamicThinFrame(
&m_wndInside
) ) )
)
{
TRACE0("Failed to create my resizable bar\n");
return . . .;
} Before the code enters part C, the m_wndInside window is a child of the m_wndBar window. After that, m_wndInside is a child of the dynamically created CProfStudioThinFrame window. The CProfStudioThinFrame window is a child of the m_wndBar window. So, the CProfStudioThinFrame window simply injects itself between the m_wndInside and m_wndBar windows. The CProfStudioThinFrame class automatically deletes itself when the window layout is destroyed. This allows you to forget about it after its initialization is complete.
|
|
Adam Keadey
|
Aug 31, 2007 - 12:22 PM
|
I want to blink the title bar by swapping the text color and background color using a timer.
What can I override to do this?
|
|
Technical Support
|
Sep 21, 2007 - 5:29 AM
|
We think handling clicks on the caption of a control bar (a floating mini frame) is not a good idea in this context because the control bar’s child window gets focused in this case and the control bar’s window become active as a result. Instead, you could analyze if the control bar’s active state has changed. If it works for you, you can override the CExtControlBar::OnUpdateCmdUI() virtual method, invoke the parent class’s method and check what is the flag value returned by CExtControlBar::IsBarWindowActive() .
|
|
Adam Keadey
|
Sep 20, 2007 - 11:00 AM
|
I would really prefer to have it blink forever if there is a way to reserve a number like -2 or use 0 like I previously suggested to flash forever.
|
|
Technical Support
|
Sep 20, 2007 - 10:36 AM
|
You can stop flashing by using pBar->FlashCaption(); without parameters. The zero value should not be used in nFlashCaption parameter. The "forever" flashing is implemented as 65635 value in nFlashCaption (you can also specify 1000000 in it). That is not forever actually but quite close to forever. To test the flashing feature, you can put the following lines at the end of the CMainFrame::OnCreate() method of the SDIDOCVIEW sample: m_wndResizableBarEdit.FlashCaption( 65535, 375 );
m_wndResizableBarCP.FlashCaption( 65535, 500, RGB(224,224,224), RGB(132,0,132) );
m_wndResizableBarTree.FlashCaption( 65535, 250, RGB(255,255,0), RGB(0,128,0) );
|
|
Technical Support
|
Sep 18, 2007 - 11:30 AM
|
We are sorry for this inconvenience. We fixed this compilation problem. So, you can request the updated source by email at support@prof-uis.com.
|
|
Technical Support
|
Aug 31, 2007 - 1:24 PM
|
The caption of a control bar is painted in the CExtControlBar::DoPaintNC() virtual method. so you can override it. Your DoPaintNC() method should be similar to the original one and invoked on timer. The following part of the original method paints the caption: CExtPaintManager::PAINTGRIPPERDATA _pgd(
this,
rcGrip,
rcText,
IsBarWindowActive(),
false,
bHorz && !bGripperAtTop,
!bFixedMode,
sCaption.IsEmpty() ? LPCTSTR( NULL ) : sCaption,
( (g_ResourceManager->OnQueryLangLayout()&LAYOUT_RTL) != 0 ) ? true : false
);
PmBridge_GetPM()->PaintGripper( *pDC, _pgd ); You can simply replace the IsBarWindowActive() code with true or false value depending on timer invocation and bar caption will blink. Additionally, the tabbed bar group’s caption is part of the CExtDynTabControlBar window. So, you will also need to create your CExtDynTabControlBar -derived class which implements its own blinking caption. Here is how you can use your own tab container control bar in Prof-UIS (you should handle the CExtControlBar::g_nMsgCreateTabbedBar registered message): afx_msg LRESULT OnMsgCreateTabbedBar( WPARAM wParam, LPARAM lParam );
ON_REGISTERED_MESSAGE( CExtControlBar::g_nMsgCreateTabbedBar, OnMsgCreateTabbedBar )
LRESULT CMainFrame::OnMsgCreateTabbedBar( WPARAM wParam, LPARAM lParam )
{
lParam;
CExtDynTabControlBar ** ppBar = (CExtDynTabControlBar **)wParam;
(*ppBar) = new C_YOUR_DynTabControlBar;
return 0L;
} The CExtControlBar::_GetNearestTabbedContainer() virtual method returns NULL if the control bar is not in the tabbed group. It returns a pointer to your C_YOUR_DynTabControlBar object otherwise, So, you will be able to detect which bar should start the timer in order to produce the caption blinking effect.
|
|
Adam Keadey
|
Sep 1, 2007 - 6:36 AM
|
OK that first part takes care of the all the docked control bars, but does not do anything for the floating control bars.
I looked arounbd and could seem to find anything that changes the way a floating control bar draws the title bar.
Help?
|
|
Technical Support
|
Sep 1, 2007 - 9:39 AM
|
Floating control bars are actually placed inside a CExtMiniDockFrameWnd container window, which is also kind of CFrameWnd . The floating caption is part of this mini frame. The pBar->GetParentFrame() code can return a pointer to the main frame or to the floating mini frame depending on where is the control bar exactly, docked or floating. So, in the case of the mini frame, you should simply repaint its non-client area instead of control bar’s.
|
|
Adam Keadey
|
Sep 4, 2007 - 9:51 AM
|
So I have the docked window repainting.
Question 1: To force the repaint I’m getting a ptr to main frame from AfxGetMainWnd() and calling RecalcLayout. Is this what I should be doning or there a better solution to repaint. I tried several other things and this seems to work, but I’m worried about calling that function for every window that I want to blink.
Question 2: In the CExtMiniDockFrameWnd I see that in the RenderNC function there is similar code to the CExtControlBar for drawing the caption. I’m assuming this is the function that I should override. How do I make the redraw happen on my new class instead of on the PROF-UIS CExtMiniDockDrameWnd? It seems that I need the original allocation of the CExtMiniDockFrameWnd to be my new class CMyMiniDockFrameWnd.
Question 3: This may be premature, but How do I force this to redraw? Will RecalcLayout work for floating windows as well? Assuming this is right call to make for forcing the repaint.
|
|
Technical Support
|
Sep 4, 2007 - 1:09 PM
|
The RecalcLayout() method repositions all the bars in the frame window at once after delaying position changing queries in one or several bars. It is not good to use it here. Please use the following code: CExtControlBar * pBarToRedrawCaption = . . .
CExtControlBar * pNearestContainer = pBarToRedrawCaption->_GetNearestTabbedContainer();
if( pNearestContainer != NULL )
pNearestContainer->SendMessage( WM_NCPAINT );
else
pBarToRedrawCaption->SendMessage( WM_NCPAINT );
CFrameWnd * pFrame = pBar->GetParentFrame();
ASSERT_VALID( pFrame );
if( pFrame->IsKindOf( RUNTIME_CLASS( CMiniFrameWnd ) ) )
pFrame->SendMessage( WM_NCPAINT );
|
|
Adam Keadey
|
Sep 4, 2007 - 1:53 PM
|
Question 1 Is this supposed to answer my other questions as well? I’m wondering about how to blink the floating control bar? I assume I need to override the code the allocates the CExtMiniFrameWnd to insert my custom draw code, but can not figure out how to accomplish it.
Question 2
CFrameWnd * pFrame = pBar->GetParentFrame();
Is pBar here refering to the pBarToRedrawCaption ptr from the code provided?
|
|
Technical Support
|
Sep 5, 2007 - 6:12 AM
|
Yes, you are right. You need to create and use a CExtMiniDockFrameWnd -derived class which implements the CExtMiniDockFrameWnd::RenderNC() virtual method which is similar to the original one but implements two variants of the caption painting. One is the default caption painting: CExtPaintManager::PAINTGRIPPERDATA _pgd(
this,
rcCapt,
rcText,
bActive,
true,
false,
bExtBar,
sCaption.IsEmpty() ? LPCTSTR( NULL ) : sCaption,
( (g_ResourceManager->OnQueryLangLayout()&LAYOUT_RTL) != 0 ) ? true : false
);
PmBridge_GetPM()->PaintGripper( dc, _pgd ); The second one should paint the caption manually instead of invoking the code above. The rcCapt rectangle specifies the caption area which you can fill with some color/gradient and then paint the sCaption caption text into the rcText rectangle. This is only the difference between your class and CExtMiniDockFrameWnd class. You will also need the following class to make all the bars in your main frame window using the new floating mini frame window implementation: class FriendlyFrameWnd : public CFrameWnd
{
public:
bool SetupNewMiniDockFrameWnd()
{
m_pFloatingFrameClass = RUNTIME_CLASS( CYourMiniDockFrameWnd );
return true;
}
}; The CYourMiniDockFrameWnd class is derived from CExtMiniDockFrameWnd . To setup the main frame window in your project using the new floating mini frame implementation, you should invoke the following code before creating any control bars: CMainFrame * pMainFrame = . . .
((FriendlyFrameWnd*)pMainFrame)->SetupNewMiniDockFrameWnd(); We think you should not spend your time on this task if you provide us with all details. It is not a problem to improve the CExtMiniDockFrameWnd and CExtControlBar classes in Prof-UIS and implement some new method in the CExtControlBar class like the follows: void FlashCaption(
INT nFlashCount = -1, // negative value cancels current flashing
INT nStepMilliseconds = 250,
COLORREF clrFlashText = RGB(255,255,255),
COLORREF clrFlashBackground = RGB(255,0,0)
); This will also work in case of toolbars and the menu bar. Besides, we have not discussed three additional cases: 1) If the control bar is inside a tabbed container and it is not selected or it is selected. Should the tab item flash? 2) If the control bar is auto hidden. Should the auto hide tab flash? Should the caption of the control bar window displayed from auto hide tabs with slide effect flash? 3) In the case of dynamic resizable control bars in document mode ( see the SDI_DynamicBars and MDI_DynamicBars sample applications): should their tab items flash and should the caption of MDI child frame window flash?
|
|
Adam Keadey
|
Sep 5, 2007 - 11:24 AM
|
This code does not work or I’m missing something
CMainFrame * pMainFrame = . . . ((FriendlyFrameWnd*)pMainFrame)->SetupNewMiniDockFrameWnd();
Each time I create a docking window it set the m_pFloatingFrameClass back to CExtMiniDockFrameWnd.
I also discovered that if I override the following function
CExtMiniDockFrameWnd * CDRControlBar::OnCreateFloatingFrame( DWORD dwStyle )
I can simply allocate my own derived class.
So the end result is when I start my app any floating control bars will not blink. If I dock it and float it then it calls the above function and works fine.
|
|
Technical Support
|
Sep 5, 2007 - 12:52 PM
|
It would be very helpful to debug your project. You can send it to support@prof-uis.com. In any case, we would prefer to implement this in Prof-UIS and provide you with the updated source code. Does it work for you? This should take a few days only. You could switch to a new version of Prof-UIS after that.
|
|
Adam Keadey
|
Sep 5, 2007 - 1:05 PM
|
Sure,
Let me tell what I truely want then. Its a common feature in many applications.
I want to be able to set the control flashing (meaning I have new information in that window the needs to be recognized). Then when the user brings that window to be topmost, or activated that flashing stops.
So if the flashing functionality could include the ability to start the flash and have it end when the window is activate again it would be great.
|
|
Technical Support
|
Sep 7, 2007 - 5:58 AM
|
We partially implemented the feature your requested (see it in this sample application). We will add the flashing for tabs and auto-hide tabs a bit later.
|
|
Adam Keadey
|
Sep 7, 2007 - 8:17 AM
|
When will this be avaliable?
Any likely hood adding the functionality to stop the blinking when the window is clicked on?
|
|
Technical Support
|
Sep 10, 2007 - 11:47 AM
|
You can download the updated source code from our ftp site (contact us via email for how to download it). We added the following methods to the CExtControlBar class: virtual bool FlashCaptionIsInProgress(
bool * p_bFlashCaptionHighlightedState = NULL
) const;
virtual bool FlashCaption(
INT nFlashCount = -1, // negative value cancels current flashing
INT nStepMilliseconds = 250,
COLORREF clrFlashText = RGB(255,255,255),
COLORREF clrFlashBackground = RGB(255,0,0)
); There is a new CExtTMDBS template class that provides MDI tab windows with ability to flash tab items corresponding to dynamic control bars in document mode (i.e. you should use the CExtTMDBS < CExtTabMdiWnd > template-based type instead of CExtTabMdiWnd ). The tab items in the SDI tab page container are highlighted automatically.
|
|
Adam Keadey
|
Sep 18, 2007 - 9:22 AM
|
I have downloaded release you posted and get the following compile error for the dll:
ExtPrint.cpp ..\INCLUDE\ExtTabWnd.h(2320) : error C2950: ’CExtTMDBS<CExtTabMdiWnd>’ : cannot explicitly instantiate an explicit specialization ..\INCLUDE\ExtTabWnd.h(2646) : fatal error C1903: unable to recover from previous error(s); stopping compilation ExtTreeWnd.cpp ExtTreeGridWnd.cpp ..\INCLUDE\ExtTabWnd.h(2320) : error C2950: ’CExtTMDBS<CExtTabMdiWnd>’ : cannot explicitly instantiate an explicit specialization ..\INCLUDE\ExtTabWnd.h(2646) : fatal error C1903: unable to recover from previous error(s); stopping compilation ExtToolControlBar.cpp ..\INCLUDE\ExtTabWnd.h(2320) : error C2950: ’CExtTMDBS<CExtTabMdiWnd>’ : cannot explicitly instantiate an explicit specialization ..\INCLUDE\ExtTabWnd.h(2646) : fatal error C1903: unable to recover from previous error(s); stopping compilation ExtToolBoxWnd.cpp ..\INCLUDE\ExtTabWnd.h(2320) : error C2950: ’CExtTMDBS<CExtTabMdiWnd>’ : cannot explicitly instantiate an explicit specialization ..\INCLUDE\ExtTabWnd.h(2646) : fatal error C1903: unable to recover from previous error(s); stopping compilation ExtTaskPaneWnd.cpp ExtTabWnd.cpp
...
It just keeps going like that.
|
|
Adam Keadey
|
Sep 20, 2007 - 9:23 AM
|
Could you give me your smaple project?
In the sample you gave me the windows seemed to flash and not stop.
How do I make them flash and not stop?
ool CExtControlBar::FlashCaption( INT nFlashCount, // = -1 // negative value cancels current flashing INT nStepMilliseconds, // = 250 COLORREF clrFlashText, // = RGB(255,255,255), COLORREF clrFlashBackground // = RGB(255,0,0) )
I have to put a number in the flash count. I would assume that a 0 would flash forever, but that is not the case.
|
|
Pawel Kalinowski
|
Aug 31, 2007 - 2:32 AM
|
Hi!
Just noticed that you can close a resizable bar when releasing lmb over its close gadget - but without pressing it first. To reproduce start the TabbedBars demo, make a Resiable bar 0 small enough for it to have scrollers, press lmb over the scroller and move the mouse to the close gadget. Release lbm and the bar will close.
About grids: is there a way to allow marking text displayed in a grid cell? I know there’s inline editing, but it doesn’t make much sense in our application. Marking text with clipboard copy support would be much much nicer.
Regards
|
|
Technical Support
|
Sep 1, 2007 - 12:44 PM
|
Thank you for your report. Please update the ../Prof-UIS/Src/ExtControlBar.cpp file in order to fix the issue.
UPDATED-ExtControlBar.zip
You can changed the grid cell’s font, text color and background color. But at the moment there is no a cell class which paints text like RTF/HTML
|
|
Henri Hein
|
Aug 30, 2007 - 8:32 PM
|
When the user sorts on a column in a CExtReportGridWnd, we want to use some underlying data to sort on, not the actual data in the column.
I tried setting up a CExtReportGridSortOrder, but it’s unclear how and when to use this. I tried overriding ReportSortOrderGet(), but this appears to be ignored. (BTW, it’s also called quite a surprising number of times during initial population of the grid, but that is probably not related). Calling ReportSortOrderSet() likewise appears ignored.
It’s possible I don’t understand how to use the ReportGridSortOrder class. Do I add new columns to it, or columns from the grid, or columns from the underlying data provider? It’s all pretty confusing.
Any pointers would be appreciated.
|
|
Henri Hein
|
Sep 6, 2007 - 1:14 PM
|
I can’t get this to work. The CTOR on my specialization is getting called when I call ReportItemGetCell(), so it seems like the grid is using my class. However, Compare() or Assign() on my class never gets called.
I got most of my problems solved with the OnGbwAnalyzeCellMouseClickEvent() override. I figure out which column was clicked, then tell the grid to sort on the surrugate column instead, using a ReportGridSortOrder instance over that column.
I still have two problems: 1. There is no visual indication which column is sorted on -- or rather, which column the user thinks was sorted on. I’d like to somehow indicate the column the user clicked, so they have an idea what the current sort data is. 2. Texts are not sorted alphabetically. You have advised in the past to use a cell class override to overcome this problem, but since I can’t get that to work, I either need help with that or an alternate suggestion.
|
|
Technical Support
|
Sep 7, 2007 - 5:21 AM
|
If some overridden virtual methods are not called, you should try these steps:
1) Check the signatures of the overridden methods again in order to make sure there are no typos. They should be exactly the same as in the base class.
2) Rebuild your project completely using the Build | Rebuild menu command in Visual Studio.
3) Send us the source code of your cell class so we can check it ourselves.
The sorted columns are visible as sorted because their header captions contain sort arrows. It seems you want to higdhlight grid cell backgrounds for all the cells in all the sorted columns. In this case you should override the following virtual method in your grid class: virtual bool OnGridHookCellPaintBackground(
const CExtGridCell & _cell,
CDC & dc,
LONG nVisibleColNo,
LONG nVisibleRowNo,
LONG nColNo,
LONG nRowNo,
INT nColType,
INT nRowType,
const RECT & rcCellExtra,
const RECT & rcCell,
const RECT & rcVisibleRange,
DWORD dwAreaFlags,
DWORD dwHelperPaintFlags
) const; In the case of report grid, you can invoke pGrid->GridCellGetOuterAtTop( nColNo, 0L ) to get a pointer to a CExtReportGridColumn object which indentifies the report column and then check if it presents in the current sort order. Your virtual method should simply return false for unsorted columns. It should fill the custom background in the rcCellExtra rectangle and return true for sorted columns. The CExtReportGridWnd::ReportSortOrderGet() method returns a reference to the CExtReportGridSortOrder object which describes the current sorting rules. The CExtReportGridSortOrder::ColumnGetIndexOf() method allows you to determine if the CExtReportGridColumn object is present in the sort order.
|
|
Henri Hein
|
Aug 31, 2007 - 7:19 PM
|
Update:
From your example I realized I could just cast a newly added cell to my own type. However, this just helped me confirm that my data is added to the specialized cell correctly. The ’Compare()’ method never gets called.
|
|
Technical Support
|
Sep 1, 2007 - 7:16 AM
|
Your grid cell class should look like: class CYourGridCell : public CExtGridCellString
{
public:
DECLARE_SERIAL( CYourGridCell );
IMPLEMENT_ExtGridCell_Clone( CYourGridCell, CExtGridCellString );
CYourGridCell( CExtGridDataProvider * pDataProvider = NULL )
: CExtGridCellString( pDataProvider )
{
}
CYourGridCell( const CExtGridCell & other )
: CExtGridCellString( other )
{
}
virtual int Compare(
const CExtGridCell & other,
DWORD dwStyleMask = __EGCS_COMPARE_MASK,
DWORD dwStyleExMask = __EGCS_EX_COMPARE_MASK
) const
{
ASSERT_VALID( this );
CYourGridCell * pCell =
DYNAMIC_DOWNCAST(
CYourGridCell,
( const_cast < CExtGridCell * > ( &other ) )
);
if( pCell == NULL )
return
CExtGridCellString::Compare(
other,
dwStyleMask,
dwStyleExMask
);
// The other cell is also CYourGridCell, compare properties
// of CYourGridCell here and return -1 or +1 if they are not equal.
return CExtGridCellString::Compare( other, dwStyleMask, dwStyleExMask );
}
virtual void Assign( const CExtGridCell & other )
{
ASSERT_VALID( this );
CExtGridCellString::Assign( other );
CYourGridCell * pCell =
DYNAMIC_DOWNCAST(
CYourGridCell,
( const_cast < CExtGridCell * > ( &other ) )
);
if( pCell != NULL )
{
// The other cell is also CYourGridCell, assign properties
// of CYourGridCell class here.
}
else
{
// The other cell is not CYourGridCell, clear properties
// of CYourGridCell class here.
}
}
};
// This line of code should be in beginning of .CPP file before
// definition of MFC’s debug new operator:
IMPLEMENT_SERIAL( CYourGridCell, CExtGridCellString, VERSIONABLE_SCHEMA|1 ); That is the minimal implementation of a custom grid cell class which is compared during sorting and can be cloned for storing inside the grid’s data provider which manages a special memory pool for cell objects. If you need to copy/paste/save restore grid cells of your type, the you should also implement the Serialize() virtual method. We have used the CExtGridCellString class as the base in the sample code above. It can be of any different grid cell class in your project.
|
|
Henri Hein
|
Sep 1, 2007 - 1:37 PM
|
OK, I didn’t know the Assign() method was required. I will try that.
Thanks, - Henri
|
|
Henri Hein
|
Aug 31, 2007 - 6:57 PM
|
This doesn’t work. I tried creating my own cell class and overrode the Compare() method. I had two big problems with this approach to begin with. First, I’m not looking to change behavior at the cell level, but at the column level, so creating a specialized cell class did not make a lot of sense. Secondly, you do not provide a way to get instances of my own class back from the grid, at least not that I could find, so I had to rely on the embedded LParam value to store my sort value. Even with this workaround, my specialization was ignored and the grid still got sorted as it used to.
The solution still seems to be in the ReportSortOrderGet() override. I was able to get this override to work, at least on initial sorting, but I haven’t found a way to intercept the sort events and impose my sort order at that time.
|
|
Technical Support
|
Aug 31, 2007 - 12:56 PM
|
Assigning the sort/group order to the report grid control activates an algorithm which rebuilds and resorts tree items in the report grid control. All the rows are compared with each other. All the grid cells are also compared with each other for all the sorted columns. The comparison of two grid cells in each column is performed in the CExtGridCell::Compare() method. So if you want to implement a custom sorting, you should simply create and use a custom grid cell class, which is derived from some Prof-UIS grid cell class, that implements the virtual method mentioned above.
|
|
Xiaoli Bi
|
Aug 30, 2007 - 9:56 AM
|
|
|
Xiaoli Bi
|
Aug 30, 2007 - 10:51 PM
|
After debug again and again, I find the reason of the issue.
Below is defined in Windows SDK #if (_WIN32_IE >= 0x0400) //----- New flags for wizard97 ----------- #if (_WIN32_IE < 0x0500) #define PSH_WIZARD97 0x00002000 #else #define PSH_WIZARD97 0x01000000 #endif
In my project (VS2005 MFC Extension DLL), the _WIN32_IE is 0x0600, so the PSH_WIZARD97 = 0x01000000 In Prof-UIS Project, ExtResizableDialog.cpp file if( (m_psh.dwFlags&(PSH_WIZARD97)) == (PSH_WIZARD97) ) It seem the PSH_WIZARD97 = 0x00002000, so the title will not be draw.
I think you can replace it with if( (m_psh.dwFlags&(0x00002000)) == (0x00002000) || (m_psh.dwFlags&(0x01000000)) == (0x01000000)) to get better compatibility.
Good luck! :)
|
|
Xiaoli Bi
|
Aug 30, 2007 - 7:00 PM
|
I almost copy whole codes of your propertysheet example. It works in exe project but failed in my MFC extension DLL project.
By the way, is there a example to use resizable dialog to use the wizard mode?
|
|
Technical Support
|
Aug 30, 2007 - 1:00 PM
|
We believe it’s possible to change the internal initialization sequences in the resizable property sheet and page windows to make them working in your project, but this will definitively not be working in both our sample applications and other existing customer applications. It’s strongly recommended to switch to using a resizable dialog with a tab page container inside and insert other child resizable dialogs into it as tab pages. This construction will be better skinned/themed and working stable.
|
|
Suhai Gyorgy
|
Aug 29, 2007 - 3:11 PM
|
I’ve used __EGBS_EX_CELL_EXPANDING_OUTER style for my grid, but the expanding happens even if the text in the outer cell is short enough to entirely fit the cell. I also reproduced this in ProfUIS_Controls sample’s grid page.
Please check this issue. Thank you!
|
|
Technical Support
|
Sep 3, 2007 - 10:11 AM
|
We are sorry for the delay with this reply. To fix the expanding behavior of the outer header cells, please update the source code for the CExtGridCell::OnInitExpandWnd() method: bool CExtGridCell::OnInitExpandWnd(
CExtGridWnd & wndGrid,
const CExtGridHitTestInfo & htInfo,
CExtContentExpandWnd & wndContentExpand,
const RECT & rcExpand,
INT nSizeOfExpandShadow
)
{
ASSERT_VALID( this );
ASSERT_VALID( (&wndGrid) );
ASSERT( ! htInfo.IsHoverEmpty() );
ASSERT( htInfo.IsValidRect() );
ASSERT( nSizeOfExpandShadow >= 0 );
rcExpand;
if( (GetStyleEx()&__EGCS_EX_UNDEFINED_ROLE) != 0
|| IsEmpty()
)
return false;
if( wndGrid.GetSafeInplaceActiveHwnd() != NULL )
return false;
if( (htInfo.m_dwAreaFlags&__EGBWA_CELL_TEXT) == 0
|| htInfo.m_rcPart.IsRectEmpty()
)
return false;
INT nSizeOfDynamicShadow = 0;
if( wndContentExpand.m_ctrlShadow.IsAvailable() )
{
nSizeOfDynamicShadow = nSizeOfExpandShadow;
nSizeOfExpandShadow = 0;
}
CRect rcExpandInit( 0, 0, 0, 0 );
{ // block for CDC
CClientDC dc( (CWnd*)&wndGrid );
INT nColType = htInfo.GetInnerOuterTypeOfColumn();
INT nRowType = htInfo.GetInnerOuterTypeOfRow();
CSize sizeCellMeasured =
MeasureCell(
&wndGrid,
dc,
htInfo.m_nVisibleColNo,
htInfo.m_nVisibleRowNo,
htInfo.m_nColNo,
htInfo.m_nRowNo,
nColType,
nRowType
);
CSize sizeCellReal = htInfo.m_rcItem.Size();
if( sizeCellReal.cx >= sizeCellMeasured.cx
&& sizeCellReal.cy >= sizeCellMeasured.cy
)
return false;
CSize sizeReqiredForText =
OnMeasureTextSize(
wndGrid,
dc,
htInfo.m_nVisibleColNo,
htInfo.m_nVisibleRowNo,
htInfo.m_nColNo,
htInfo.m_nRowNo,
nColType,
nRowType,
htInfo.m_rcExtra,
htInfo.m_rcItem,
htInfo.m_rcPart,
htInfo.m_dwAreaFlags
);
CSize sizeCellText = htInfo.m_rcPart.Size();
UINT nDrawTextFlagsReal =
OnQueryDrawTextFlags(
htInfo.m_nVisibleColNo,
htInfo.m_nVisibleRowNo,
htInfo.m_nColNo,
htInfo.m_nRowNo,
nColType,
nRowType,
htInfo.m_dwAreaFlags,
0
);
if( (nDrawTextFlagsReal&DT_RIGHT) != 0 )
{
rcExpandInit.SetRect(
htInfo.m_rcPart.right - sizeReqiredForText.cx,
htInfo.m_rcPart.top,
htInfo.m_rcPart.right,
htInfo.m_rcPart.top + sizeReqiredForText.cy
);
} // if( (nDrawTextFlagsReal&DT_RIGHT) != 0 )
else
{
rcExpandInit.SetRect(
htInfo.m_rcPart.left,
htInfo.m_rcPart.top,
htInfo.m_rcPart.left + sizeReqiredForText.cx,
htInfo.m_rcPart.top + sizeReqiredForText.cy
);
if( (nDrawTextFlagsReal&DT_CENTER) != 0 )
{
rcExpandInit.OffsetRect(
( htInfo.m_rcPart.Width() - rcExpandInit.Width() ) / 2,
0
);
} // if( (nDrawTextFlagsReal&DT_CENTER) != 0 )
} // else from if( (nDrawTextFlagsReal&DT_RIGHT) != 0 )
if( (nDrawTextFlagsReal&DT_BOTTOM) != 0 )
{
rcExpandInit.OffsetRect(
0,
( htInfo.m_rcPart.Height() - rcExpandInit.Height() )
);
} // if( (nDrawTextFlagsReal&DT_BOTTOM) != 0 )
else if( (nDrawTextFlagsReal&DT_VCENTER) != 0 )
{
rcExpandInit.OffsetRect(
0,
( htInfo.m_rcPart.Height() - rcExpandInit.Height() ) / 2
);
} // else if( (nDrawTextFlagsReal&DT_VCENTER) != 0 )
if( sizeCellText.cx >= sizeReqiredForText.cx
&& sizeCellText.cy >= sizeReqiredForText.cy
)
{
CRect rcClient = wndGrid.OnSwGetClientRect();
if( rcExpandInit.bottom <= rcClient.bottom
&& rcExpandInit.top >= rcClient.top
&& rcExpandInit.right <= rcClient.right
&& rcExpandInit.left >= rcClient.left
)
return false;
}
// rcExpandInit.SetRect(
// htInfo.m_rcPart.left,
// rcExpand.top,
// htInfo.m_rcPart.left + sizeReqiredForText.cx,
// rcExpand.bottom
// );
// if( rcExpandInit.Height() < sizeReqiredForText.cy )
// rcExpandInit.bottom = rcExpandInit.top + sizeReqiredForText.cy;
rcExpandInit.InflateRect(
__EXT_EXPANDED_TEXT_GAP_X,
__EXT_EXPANDED_TEXT_GAP_Y
);
rcExpandInit.InflateRect(
0,
0,
nSizeOfExpandShadow,
nSizeOfExpandShadow
);
wndGrid.ClientToScreen( &rcExpandInit );
rcExpandInit =
CExtPaintManager::stat_AlignWndRectToMonitor(
rcExpandInit,
false,
true
);
wndGrid.ScreenToClient( &rcExpandInit );
} // block for CDC
ASSERT( !rcExpandInit.IsRectEmpty() );
bool bRetVal =
wndContentExpand.Activate(
rcExpandInit,
&wndGrid,
__ECWAF_DEF_EXPANDED_ITEM_PAINTER
|__ECWAF_DRAW_SOURCE
|__ECWAF_NO_CAPTURE
|__ECWAF_REDIRECT_MOUSE
|__ECWAF_REDIRECT_NO_DEACTIVATE
|__ECWAF_REDIRECT_AND_HANDLE
|__ECWAF_HANDLE_MOUSE_ACTIVATE
|__ECWAF_MA_NOACTIVATE
);
if( nSizeOfDynamicShadow && wndContentExpand.GetSafeHwnd() != NULL )
wndContentExpand.m_ctrlShadow.Create( wndContentExpand.m_hWnd, nSizeOfDynamicShadow );
return bRetVal;
} Thank you.
|
|
Byron Blattel
|
Aug 29, 2007 - 2:38 PM
|
I’ve overidden CExtGridCellButton::OnGetToolTipText() but it’s not getting called.
I’ve also tried overiding MyReportGrid::OnGridCellGetToolTipText(), it get’s called for header cells but not for inner cells. I have the __EGBS_EX_CELL_TOOLTIPS style set and cells that are narrower than their text display the tooltip, even though OnGridCellGetToolTipText() is not called. I’m also calling EnableTooltips()...
What am I missing?
|
|
Technical Support
|
Aug 30, 2007 - 11:38 AM
|
You can set custom tooltip text for a cell by overriding the CExtGridCell::OnInitToolTip() method in the cell class like as follows: // DECLARATION
class CExtGridCellTooltip : public CExtGridCell
{
public:
DECLARE_SERIAL( CExtGridCellTooltip );
IMPLEMENT_ExtGridCell_Clone( CExtGridCellTooltip, CExtGridCell );
CExtGridCellTooltip(
CExtGridDataProvider * pDataProvider = NULL
);
// virtual methods
virtual bool OnInitToolTip(
CExtGridWnd & wndGrid,
const CExtGridHitTestInfo & htInfo,
CToolTipCtrl & wndToolTip,
UINT nToolNo,
const RECT & rcTool
);
}; // class CExtGridCellTooltip
//IMPLEMENTATION
/////////////////////////////////////////////////////////////////////////////
// CExtGridCellTooltip
IMPLEMENT_SERIAL( CExtGridCellTooltip, CExtGridCell, VERSIONABLE_SCHEMA|1 );
CExtGridCellTooltip::CExtGridCellTooltip(
CExtGridDataProvider * pDataProvider // = NULL
)
: CExtGridCell ( pDataProvider )
{
}
bool CExtGridCellTooltip::OnInitToolTip(
CExtGridWnd & wndGrid,
const CExtGridHitTestInfo & htInfo,
CToolTipCtrl & wndToolTip,
UINT nToolNo,
const RECT & rcTool
)
{
ASSERT_VALID( this );
ASSERT_VALID( (&wndGrid) );
ASSERT( ! htInfo.IsHoverEmpty() );
ASSERT( htInfo.IsValidRect() );
htInfo;
bool bRetVal = false;
CExtSafeString strText( _T("Tooltip Text") );
if( strText.GetLength() > 0 )
{
wndToolTip.AddTool(
&wndGrid,
(LPCTSTR)strText,
&rcTool,
nToolNo
);
bRetVal = true;
}
if( ! bRetVal )
{
wndToolTip.DelTool( &wndGrid, nToolNo );
CWnd::CancelToolTips();
} // if( ! bRetVal )
return bRetVal;
}
Here is how you can use it
CExtGridCellTooltip * pCellTooltip =
STATIC_DOWNCAST(
CExtGridCellTooltip,
m_wndGrid.GridCellGet(
4,
nRowNo,
0,
0,
RUNTIME_CLASS(CExtGridCellTooltip)
)
); Please note you should disable the content pop-up window for grid cells. Such a tooltip-like window shows the cell content for a cell which is partially visible. m_wndGrid.EnableTooltips(
true,
true,
true,
true,
true
);
m_wndGrid.EnableExpanding(
false,
false,
false,
false,
false
);
|
|
Byron Blattel
|
Aug 30, 2007 - 5:29 PM
|
It was the expanding tips part that was the problem.
I need to have a separate tooltip for the button cells and keep the so-called ’expanding’ tips. I have buttons in cells that are just icons, no text.
I’ve gotten it to work by overriding OnGbwHoverRecalc() to allow both ’bExpandItem’ and ’bTooltipItem’ to be true by eliminating the ’else if’s and added a premature call to OnGbwTooltip() before checking ’bExpandItem’ and ’bTooltipItem’. This works as expected if I return true from my OnGridCellGetToolTipText() override and leave strToolTipText empty (so that the buried call to CExtGridCell::OnInitAdvancedTip() returns false).
I’d like to make a feature request that both expanding tips and ’overriden’ tips be possible in the core product.
|
|
Technical Support
|
Sep 3, 2007 - 10:15 AM
|
This feature is already in our TO-DO list. We will notify you when it is ready.
|
|
Brian Horn
|
Aug 29, 2007 - 4:18 AM
|
We are using the grid control CExtPropertyGridCtrl We wish to have the text of different font and make it non-bold. Do we have to use the PaintManager object for this, if yes how ?
|
|
Technical Support
|
Aug 30, 2007 - 10:57 AM
|
You can assign a custom font using the SetFont() method.
There are two properties in the CExtPropertyGridWnd class:
m_bMakeBoldModifiedNames specifies if the names of modified properties are displayed in bold.
m_bMakeBoldModifiedValues specifies if the the values of modified properties are displayed in bold.
So to make all the cells non-bold when their values are in the modified state, just set these properties to false. You can find en example of how to do this in the CMainDlg::OnCheckMakeBoldModifiedCaptions() and CMainDlg::OnCheckMakeBoldModifiedValues() methods in the PropertyGrid sample.
|
|
Brian Horn
|
Aug 29, 2007 - 4:18 AM
|
Hi, We are facing one major issue related to docking of controlbar and ribbonbar, if we create ribbonbar in childframe and controlbar in mainframe. Then controlbar gives docking problem.
We have created one sample application. In this sample when we launch application it shows a controlbar. 1. Press CRTL+N to create child window. Child window will appear on screen along with ribbonbar(we have created ribbonbar in childframe::OnCreateClient.) now try to dock contorlbar to left hand side of window. This will shift ribbonbar to right hand side beyond the borders of window. And ribbonbars controlwindow(maximize, minimize, close) buttons will get disappear.
2. After opening child window press CTRL + 1 that will show controlbar. We want that controlbaraˆ™s top will start from just below the ribbonbar and its bottom should be status bar if no other control bar is present. If another controlbar is already present the that controlbaraˆ™s bottom will be new controlbaraˆ™s Top.
Please find source code on below link. Please click on download button on below link that will transfer control to other page after 10 seconds it will show another download button to download the file)
http://www.MegaShare.com/265155
|
|
Brian Horn
|
Sep 7, 2007 - 12:18 PM
|
Hi, Thanks for the help. I want this dynamic controlbar should get HIDE, AUTOHIDE and destroy as other normal controlbar. Can you tell me how to this ?
|
|
Technical Support
|
Sep 8, 2007 - 12:54 PM
|
The dynamic control bars behave exactly like simple control bars except for their support for tabbed/document mode. The hide and auto-hide features are the same. But please note that in order to change the state of a dynamic control bar (hidden, auto-hidden, floating, dockable or tabbed/document), you should use the CExtDynamicControlBar::BarStateSet() method. Unlike the simple control bars, the dynamic bars are always instantiated in dynamic memory. They are allocated using the CExtDynamicBarSite::BarAlloc() method and destroyed using the CExtDynamicBarSite::BarFree() method. We think all these specifics of dynamic control bars do not make them very different.
|
|
Brian Horn
|
Sep 4, 2007 - 5:01 AM
|
Please find the attached file. In this code I tried creating dynamic controlbar. Its covering the entire framewindow. But its not showing the close button. And when I click on ctrl+N then that time this window gets shrink and doesnt get fit in remaining framewindow as it was before pressing CTRL+N
http://rapidshare.com/files/53329171/test1.zip
|
|
Technical Support
|
Sep 4, 2007 - 10:25 AM
|
We added MDI tabs with a close button to each tab in your project to let you close the bars in the document mode. We also added CMyNonAutoHideAbleControlBar::WindowProc() method to fix incorrect references between the HTML view inside a dynamic resizable bar and the main frame window at shutdown. The last problem needs some redesign in your project: it is not good to define the CExtRibbonBar property in the MDI child frame class but create it in the main frame class. We think you should use one ribbon bar control in the main frame class only and re-initialize its content when needed. We sent you a modified version of your project by email.
|
|
Brian Horn
|
Sep 4, 2007 - 3:36 AM
|
Thanks a lot for above answer.
Using object of CExtDynamicControlBar I could able do what I was expecting. Only thing now is I dont want the dropdown menu on right click of TAB name. Can you tell me how to stop that?
|
|
Technical Support
|
Sep 4, 2007 - 7:46 AM
|
Please note that the context menu over the dynamic control bar’s caption and the menu displayed from the drop-down Options button in the same caption is called Window Options menu. If you disabled it, the user will not be able to switch bar states (dockable, floating, and document). To disable this menu, you should make it empty. The empty menu will not be tracked by the control bar. The Window Options menu is constructed in the CExtDynamicControlBar::OnInitDbsMenu() virtual method. The bar caption buttons are initialized in the CExtDynamicControlBar::OnNcAreaButtonsReinitialize() virtual method. So, you should use your own CExtDynamicControlBar -derived class like as follows: class CYourBar : public CExtDynamicControlBar
{
public:
DECLARE_SERIAL( CYourBar );
CYourBar()
{
}
virtual ~CYourBar()
{
}
virtual void OnNcAreaButtonsReinitialize()
{
//
// This method will initialize both the close/hide button and
// auto-hide pin button but not the window options button.
//
ASSERT_VALID( this );
INT nCountOfNcButtons = NcButtons_GetCount();
if( nCountOfNcButtons > 0 )
return;
NcButtons_Add( new CExtDynamicBarNcAreaButtonClose(this) );
#if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
NcButtons_Add( new CExtDynamicBarNcAreaButtonAutoHide(this) );
#endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
/////// NcButtons_Add( new CExtDynamicBarNcAreaButtonMenu(this) );
}
virtual bool OnInitDbsMenu(
CExtPopupMenuWnd * pPopup,
HWND hWndTrack,
CObject * pHelperSrc,
LPARAM lParamHelper = 0
)
{
//
// This method will abandon menu construction.
//
ASSERT_VALID( this );
pPopup;
hWndTrack;
pHelperSrc;
lParamHelper;
return false;
}
};
IMPLEMENT_SERIAL( CYourBar, CExtDynamicControlBar, VERSIONABLE_SCHEMA|1 );
|
|
Brian Horn
|
Sep 2, 2007 - 10:57 PM
|
I want TOP Controlbar should cover entire client area of framewindow. Please find the images in zip file named 1 & 3. First image 1 is my requirement if bottom controlbar is present. And please refer image 3 if bottom contorlbar is absent.
I dont want to specify hardcoded values for framewindow. If I specify hardcoded value for setting height of controlbar then on maximizing application TOP Control bar and bottom contorlbar is showing GAP in between them. Please refer image 2 from below zip file.
Even on application maximize the height of TOP controlbar should get automatically set and if bottom contorlbarr is absent then height of top contorlbar must get extended to statusbar of window.
http://rapidshare.com/files/53028073/images.zip
|
|
Technical Support
|
Sep 3, 2007 - 11:06 AM
|
The resizable control bars are designed as windows docked to the borders of the main frame window. They are not designed for covering the entire frame window area. You can use dynamic resizable control bars instead. The dynamic bars can be switched into the tabbed/document mode. So, you can have several bars docked to main frame’s sides and one or more bars switched into the document mode. As a result all the main frame’s area will be covered with control bars. Please see the SDI_DynamicBars sample application for details.
|
|
Brian Horn
|
Aug 31, 2007 - 4:19 AM
|
Thanks for the first answer.
Please find the new updated source code. In this code when you compile and launch the application. Press Ctrl+N that will launch childwindow with ribbonbar. And now press button which is present in quick access button of ribbonbar.
On click this will launch controlbar just below ribbonbar. We want to set the height of this controlbar to be the top of other controlbar( if controlbar is visible). Other wise height should be till statusbar.
Source code link is as below. http://rapidshare.com/files/52424473/test.zip
And you refer to image for better understanding. http://rapidshare.com/files/52425915/1.zip
|
|
Technical Support
|
Sep 1, 2007 - 11:24 AM
|
We replaced the following lines in the CMainFrame::OnCreate() method m_wndOutput.DockControlBarInnerOuter(AFX_IDW_DOCKBAR_BOTTOM, 1 );
m_wndWindow.DockControlBarInnerOuter( AFX_IDW_DOCKBAR_LEFT, 2 ); with m_wndWindow.SetInitDesiredSizeHorizontal( CSize( 1, 50 ) ); // 50 pixel height
m_wndWindow.DockControlBarInnerOuter( AFX_IDW_DOCKBAR_TOP, 1 );
m_wndOutput.SetInitDesiredSizeHorizontal( CSize( 1, 50 ) ); // 50 pixel height
m_wndOutput.DockControlBarInnerOuter(AFX_IDW_DOCKBAR_BOTTOM, 1 ); Then we commented out the code that loads the control bars’ state and run your application. Both control bars are now 50 pixels in height. One is at top and other is at bottom. Thit mean you can control the height of control bars. Is that what you need?
|
|
Technical Support
|
Aug 29, 2007 - 1:43 PM
|
To fix the problem with control bar’s position, we modified the code at the beginning of the CChildFrame::OnCreateClient() method in your project: BOOL CChildFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
CWinApp* pApp = ::AfxGetApp();
if( ! objRibbonBar.m_wndRibbonBar.Create(
NULL,
::AfxGetMainWnd()
)
)
{
::AfxMessageBox(_T("Failed"));
TRACE0("Failed to create the m_wndRibbonBar toolbar\n");
return -1; // fail to create
}
////////////////////////////////////////////////////////////////////////////////////
/// ///
/// BEGIN: This code was added. ///
/// ///
objRibbonBar.m_wndRibbonBar.SetWindowPos(
&CWnd::wndTop, 0, 0, 0, 0,
SWP_NOMOVE|SWP_NOSIZE|SWP_NOREDRAW|SWP_NOSENDCHANGING
);
/// ///
/// END: This code was added. ///
/// ///
////////////////////////////////////////////////////////////////////////////////////
objRibbonBar._InitRibbonBar();
. . . Please provide us with more information about the Ctrl+1 command in your test project. This key combination does nothing when we run your project. We found neither such an accelerator in the resources nor VK_CONTROL constant usage in your source code.
|
|
tera t
|
Aug 29, 2007 - 3:29 AM
|
Hello.
On this bulletin board, I cannot use CharCode_7e for an address of a homepage Much CharCode_7e is used for a Japanese homepage address. I want to use CharCode_7e.
|
|
tera t
|
Sep 11, 2007 - 7:46 PM
|
|
|
Technical Support
|
Sep 12, 2007 - 12:39 PM
|
Please add the manifest resource into your project. Add the following code into the .rc2 file of your project: #if (!defined PROF_UIS_X64) && (!defined PROF_UIS_IA64) && (!defined PROF_UIS_FORCE_NO_MANIFEST)
1 24 DISCARDABLE "res\\manifest_x86.xml"
#endif Then create the manifest_x86.xml text file in the same folder with the .rc2 file. This XML file should have the following content: <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
processorArchitecture="x86"
version="5.1.0.0"
type="win32"
name="ProfUIS_SampleApplication"
/>
<description>Prof-UIS Sample Application</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
publicKeyToken="6595b64144ccf1df"
language="*"
processorArchitecture="x86"
/>
</dependentAssembly>
</dependency>
</assembly> You can find the same in any sample application provided with Prof-UIS.
|
|
tera t
|
Sep 10, 2007 - 10:56 PM
|
|
|
tera t
|
Sep 9, 2007 - 5:59 PM
|
|
|
Technical Support
|
Aug 29, 2007 - 1:39 PM
|
We are sorry but it is not completely clear what you mean. Please let us know more details about the problem.
|
|
tera t
|
Aug 29, 2007 - 8:14 PM
|
|
|
Technical Support
|
Sep 6, 2007 - 4:09 AM
|
it seems we fixed this bug. Please confirm this.
|
|
Technical Support
|
Aug 31, 2007 - 6:38 AM
|
We confirm this problem and will fix it as soon as possible. Thank you.
|
|
David Skok
|
Aug 28, 2007 - 2:40 PM
|
My app uses a CExtGridWnd populated with CExtGridCellInplaceSlider cells. I allow multiple select using __EGBS_SFM_CELLS_V. I am not able to select multiple cells using the mouse with Shift or Control keys over CExtGridCellInplaceSlider type cells. How can I fix this?
You can easily verify this by setting the style to __EGBS_SFM_CELLS_V in ProfUIS_Controls/grid sample. I notice in the sample that multiple selection works for this type of cell if it is set to read only.
|
|
Technical Support
|
Aug 29, 2007 - 12:54 PM
|
Selections in the CExtGridWnd control are described by an array of rectangles. There is a style specified with __EGBS_SFM_CELLS_V that allows you to select one rectangular selection area which can contain more than one cell in the vertical direction. If you want to select multiple areas, you should additionally apply __EGBS_MULTI_AREA_SELECTION . The Ctrl and Shift keys should work with the style __EGBS_SFM_CELLS_V and with/without __EGBS_MULTI_AREA_SELECTION . You can send us a modified version of our sample application so we can figure out what is wrong.
|
|
Jon Ort
|
Aug 28, 2007 - 1:50 PM
|
We have an application using the CExtLabel class of ProfUIS 2.80. We are finding that all shortcut/accelerator keys defined using the CExtLabel class are not working. If we use the stock static control the accelerator functions as expected.
We have constructed a sample application to demonstrate this but it appears that I can not add an attachment. The dialog does nothing, but has two pairs of static and edit controls. The statics precede the edit controls in the tab order, and the statics have shortcut/hotkey/accelerators defined with &. The expected behavior is that pressing the shortcut key on the static should move keyboard focus to the next control in the tab order (the associated edit control). If I explicitly declare the statics as CStatic variables, or disable the auto subclassing of controls, it works as expected. But if the statics are instances of CExtLabel, or are created by auto subclassing, the keyboard focus does not move and the speaker beeps. Is this a bug, and if so do you have any advice on how to fix it?
Thanks Jon
|
|
Technical Support
|
Aug 29, 2007 - 12:42 PM
|
Thank you for reporting the problem. We have just fixed it. Please open the CExtLabel::WindowProc method and replace the following code snippet else if( message == WM_GETTEXT )
{
TCHAR * lpszText = (TCHAR *)lParam;
// 2.55
// __EXT_MFC_STRCPY(
// lpszText,
// wParam,
// m_sText
// );
::memset( lpszText, 0, wParam );
__EXT_MFC_STRNCPY(
lpszText,
wParam,
m_sText,
wParam - 1
);
lpszText[ wParam - 1 ] = _T(’\0’);
lResult = TRUE;
} with this one else if( message == WM_GETTEXT )
{
lResult = CStatic::WindowProc( message, wParam, lParam );
TCHAR * lpszText = (TCHAR *)lParam;
// 2.55
// __EXT_MFC_STRCPY(
// lpszText,
// wParam,
// m_sText
// );
::memset( lpszText, 0, wParam );
__EXT_MFC_STRNCPY(
lpszText,
wParam,
m_sText,
wParam - 1
);
lpszText[ wParam - 1 ] = _T(’\0’);
} After that, recompile the library.
|
|
Jon Ort
|
Sep 4, 2007 - 2:28 PM
|
Thanks, that took care of it for the items based on that class. We have a possibly similar problem with the CExtCombo. When focus is on any part of the combo box none of the dialog accelerators work. As soon as you move to another control the accelerators work fine. When we drop back to a standard MFC combo box the accelerators work fine at all times.
Jon
|
|
Technical Support
|
Sep 18, 2007 - 11:24 AM
|
We fixed this problem. Please open the CExtComboBoxBase::PreTranslateMessage() method and find the following lines at the bottom : if( pMsg->message == WM_SYSCHAR )
return TRUE; Replace those lines with if( pMsg->message == WM_SYSCHAR )
return FALSE; That should fix the problem.
|
|
Technical Support
|
Sep 6, 2007 - 11:33 AM
|
Yes, we confirm this problem and will try to find a solution. Thank you.
|
|
Darren Oliver
|
Aug 28, 2007 - 12:40 PM
|
Hi Tech Support
I have a grid (class which inherits from CExtGridWnd) with many rows and columns. The cells inside the grid are either a CExtGridCellCheckBox or CExtGridCellComboBox. I wanted to have each cell the ability to change colour when invalid data was entered and switch back to the original colour when valid data was entered.
I tried to make a class which inherits from CExtGridCellComboBox and have that class hold the COLORREF of the original colour by calling BackColorGet() before changing the colour and using BackColorSet to change it to the invalid colour.
I am finding that I’m crashing when I call your method CExtGridWnd::RowRemoveAll(). What may be causing a problem is I iterate through each cell and retrieve it as a CExtGridCell to apply or remove the read-only style. The error I’m getting seems to vary but one is something like "invalid vtable pointer".
I may be approaching the colour changing the wrong way by inheriting from CExtGridCellComboBox and extending it with my colour codes and colour changing methods (which call your BackColorSet method) so any feedback is greatly appreciated.
Thanks, Darren
|
|
Technical Support
|
Aug 29, 2007 - 1:00 PM
|
The problem is not related to the color APIs. We guess you accessed a cell of some type when this cell is really of some other type. The methods of CExtGridWnd often use CExtGridCell* pointers. If you think that the returned CExtGridCell* pointer is really the CExtGridCellComboBox*</coded> pointer, then you should use the following code:CExtGridCell * pSimpleCell = . . .
CExtGridCell * pComboBoxCell = STATIC_DOWNCAST( CExtGridCellComboBox, pSimpleCell ); The <code>STATIC_DOWNCAST preprocessor function will raise assertion if the pSimpleCell pointer is really not a CExtGridCellComboBox* pointer. Please do not use dirty casts in C style: CExtGridCell * pComboBoxCell = (CExtGridCellComboBox*)pSimpleCell;
|
|
Suhai Gyorgy
|
Aug 29, 2007 - 5:38 AM
|
If you derive a class from any CExtGridCell-derived class, and you add any additonal class variables, you need to override Assign method. In the background, there are many copying of the cells, and this Assign method assures that the proper values of your new class variables are stored in a new instance of cell.
You can see how it’s done in CompoundProperties sample, in the CMyCompoundFontCell class.
Also, you need to add an additional macro in your class definition: IMPLEMENT_ExtGridCell_Clone( CYourCell, CBaseCell );
You might also need to override the Serialize method if your cells get serialized at any point.
|
|
Suhai Gyorgy
|
Aug 28, 2007 - 9:19 AM
|
Dear Support,
I have a grid with the __EGBS_SFB_FULL_ROWS style set. If I use the mouse to make a cell focused and then change rows with down arrow, the focused cell stays to be in the same column as before (I can check this by pressing Enter key, thus getting into edit mode). But pressing left/right arrow does not change the focused cell in the same row.
In another way: let’s say the user edits a cell, then presses Enter (comes out of inplace editor) then presses left or right arrow and then presses Enter again. Right now the same cell gets to be edited as before. I’d like to change this behaviour and have the cell on the left/right to get into edit mode.
Could you please consider this feature? Thank you!
|
|
Technical Support
|
Aug 29, 2007 - 12:36 PM
|
The full row/focus selection model means grid cells are not editable or only one column is editable. This approach is used in tree grids inside the property grid. We think you should use the full row selection model with column-based focus like in the report grid model. This is a bit tricky implementation of the selection mode. The CExtGridWnd control is configured for any cell range selection. But each selected cell range is automatically converted/extended on-the-fly for covering all the columns. The focused cell is re-painted with a non-selected background. Such grid has the full-row selection model and the single cell focus model. First of all, you should initialize your CExtGridWnd control with __EGBS_SFB_CELLS or __EGBS_SFM_CELLS selection type. Second, you should use your own CExtGridWnd -derived class which implements the following virtual methods: virtual CRect & _SelectionAreaConvert( CRect & rcArea ) const
{
ASSERT_VALID( this );
rcArea.left = 0;
rcArea.right = ColumnCountGet();
if( rcArea.right > 0 )
rcArea.right --;
return rcArea;
}
virtual COLORREF OnGridCellQueryTextColor(
const CExtGridCell & _cell,
CDC & dc,
LONG nVisibleColNo,
LONG nVisibleRowNo,
LONG nColNo,
LONG nRowNo,
INT nColType,
INT nRowType,
DWORD dwAreaFlags,
DWORD dwHelperPaintFlags
) const
{
ASSERT_VALID( this );
COLORREF clrText =
CExtGridWnd::OnGridCellQueryTextColor(
_cell,
dc,
nVisibleColNo,
nVisibleRowNo,
nColNo,
nRowNo,
nColType,
nRowType,
dwAreaFlags,
dwHelperPaintFlags
);
if( clrText != COLORREF(-1L) )
return clrText;
if( (SiwGetStyle()&__EGBS_SFB_MASK) == __EGBS_SFB_CELLS )
{
if( nColType == 0 && nRowType == 0 && nColNo >= 0 && nRowNo >= 0 )
{
CPoint ptFocus = FocusGet();
if( ptFocus.x == nColNo && ptFocus.y == nRowNo )
return OnSiwGetSysColor( COLOR_BTNTEXT );
}
}
return COLORREF(-1L);
}
virtual bool OnGridHookCellPaintBackground(
const CExtGridCell & _cell,
CDC & dc,
LONG nVisibleColNo,
LONG nVisibleRowNo,
LONG nColNo,
LONG nRowNo,
INT nColType,
INT nRowType,
const RECT & rcCellExtra,
const RECT & rcCell,
const RECT & rcVisibleRange,
DWORD dwAreaFlags,
DWORD dwHelperPaintFlags
) const
{
ASSERT_VALID( this );
if( ( dwAreaFlags & __EGBWA_INNER_CELLS ) != 0 )
{
CPoint ptFocus = FocusGet();
if( ptFocus.x == nColNo && ptFocus.y == nRowNo )
{
COLORREF clrAlternativeFocus1 =
OnSiwGetSysColor( COLOR_HIGHLIGHT );
COLORREF clrAlternativeFocus2 =
OnSiwGetSysColor( COLOR_WINDOW );
COLORREF clrAlternativeFocus =
CExtPaintManager::stat_RGB_Enlight(
clrAlternativeFocus1,
clrAlternativeFocus2,
32
);
dc.FillSolidRect(
&rcCell,
clrAlternativeFocus
);
return true;
}
}
return
CExtGridWnd::OnGridHookCellPaintBackground(
_cell,
dc,
nVisibleColNo,
nVisibleRowNo,
nColNo,
nRowNo,
nColType,
nRowType,
rcCellExtra,
rcCell,
rcVisibleRange,
dwAreaFlags,
dwHelperPaintFlags
);
}
|
|
Jia Hong Li
|
Aug 28, 2007 - 8:51 AM
|
|
|
Jia Hong Li
|
Aug 28, 2007 - 8:52 AM
|
|
|
Suhai Gyorgy
|
Aug 28, 2007 - 9:28 AM
|
The problem is that at least one of the commands in your g_statBasicCommands are not registered in the command manager. Usually, commands get registered through UpdateFromMenu or UpdateFromToolBar. So if one of those commands are not present in any menu or toolbar, then you need to register the command manually with CExtCmdManager::CmdSetup.
|
|
Ian McIntosh
|
Aug 28, 2007 - 8:44 AM
|
Hi,
I have at least 2 threads that I have not had a response on for several weeks, the threads are called:
"autohide temporarily stops working" "minimize / maximize issue"
Please can you let me know what is happening.
I have also noticed with the minimize/maximize issue if I use PreCreateWindow() to set the WS_MAXIMIZE style, the app is drawn incorrectly. If i call ShowWindow(SW_SHOWMAXIMIZED) this also gives an incorrect result. Do you have a work around that will allow me to programatically maximize my app?
|
|
Technical Support
|
Aug 30, 2007 - 11:16 AM
|
We are currently recoding the DWM integration (Desktop Window Manager on Windows Vista which implements glass effects for desktop’s child windows) of the CExtRibbonBar control. The height of the caption when the window is maximized on Windows Vista is less than that when the window is restored. This is not a problem for classic desktop windows. But desktop window with integrated ribbon bar should have a greater caption height. We are working on this problem now.
The auto-hidden bar behavior is mostly similar to dockable panes in Visual Studio .NET and Visual Studio 2005. If you close all the windows in Visual Studio, show an auto-hidden bar, set focus to some window inside this control bar and click on empty MDI/tabbed area, then the control bar will not get hidden back. The temporarily displayed auto-hidden bar should not hide itself in two cases: when the mouse is over it and when some window inside it is focused and, as a result, the control bar is active. Some windows like the MDI client area, ribbon bar, menu bar, toolbars, status bar and others never request focus on mouse clicks. That is why the displayed auto-hidden control bar does not go back to its hidden state: there are no windows which "want" to get focus. The editor windows inside a toolbar or the ribbon bar requests focus on click and displays the caret. This makes window inside the control bar unfocused and deactivates the control bar.
We confirm the other problem with auto-hide tabs near the frame border: when the edit control is focused inside a toolbar or the ribbon bar, then moving the mouse pointer over the auto-hide tab item does not lead to the the auto-hidden control bar rolls out. But clicking the tab item in this case always displays the control bar. Both mouse hover and click should display this bar. We will fix this problem as soon as possible and notify you about that.
|
|
Technical Support
|
Aug 28, 2007 - 11:54 AM
|
We are sorry for this delay. We confirm that this problem exists, when the main window is incorrectly shifted a couple of pixels upwards under the following conditions:
1) the application has the ribbon-based interface 2) the main window is maximized
We are refactoring the ribbon code so this bug will be fixed in a new release in September.
As for the problem with the autohide, we cannot yet completely confirm it. We created a control bar with a dialog and a button. We added it to the SDIDOCVIEW sample, tried to reproduce the bug and failed. Please note that when you click the button, the control’s bar caption gets highlighted and in order to hide the control bar, you should click on somewhere outside the control bar. We also added this control bar to the RibbonBar app and noticed that the problem does not occur if you click a control that takes selection (show the control bar, click the button and select a control in the ribbon, e.g. Style 1, Style 2, etc.). Anyway we will look into it once more and let you know the results tomorrow.
|
|
Debabrata Mukherjee
|
Aug 28, 2007 - 8:30 AM
|
By Highlighting here I mean that when the mouse is taken over a particular tree item , the background color of the portion occupied by the whole item label and its icon should changeI have a tree structure in my application and I want to implement it. Earlier you provided me with the following code below but I am having a few problems in understanding the functionalities in it , which i have noted down.
Here is the code you provided:
class CSettingsTreeWnd : public CTreeCtrl
{
CFont m_fontBold;
CHighImageList m_imgList;
#if (defined __SETTINGS_TREE_SUPPORTS_HOVER)
HTREEITEM m_htiMenuBoxHover;
#endif // (defined __SETTINGS_TREE_SUPPORTS_HOVER)
HTREEITEM m_htiPopupMenu;
public:
static const int g_nImgWidth;
static const int g_nImgHeight;
// Construction
public:
bool m_bRenderAlphaEffects:1;
CSettingsTreeWnd();
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CSettingsTreeWnd)
protected:
virtual void PreSubclassWindow();
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CSettingsTreeWnd();
enum e_get_item_rect_impl_t
{
__EGIRT_EXP_IMG = 0,
__EGIRT_MENU_BOX = 1,
__EGIRT_CHECK_BOX = 2,
__EGIRT_ARROW = 3,
__EGIRT_MIN_VALUE = 0,
__EGIRT_MAX_VALUE = 3
};
static CRect stat_GetItemRectImpl(
e_get_item_rect_impl_t eGIRT,
CRect rcItemText,
int nItemIndent,
int nExpImgWidth = 12,
int nExpImgHeight = 12,
int nMenuImgWidth = CSettingsTreeWnd::g_nImgWidth,
int nMenuImgHeight = CSettingsTreeWnd::g_nImgHeight
);
void _AnalyzeMenuButtonHover();
void _TrackItemMenu(
HTREEITEM hti,
bool bSelectAny = false
);
void DoUpdateNextAvail();
void ClientArea_PaintBackground( CDC & dc, CRect rcClient );
void ClientArea_PaintForeground( CDC & dc, CRect rcClient );
// Generated message map functions
protected:
//{{AFX_MSG(CSettingsTreeWnd)
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
afx_msg void OnPaint();
afx_msg void OnSettingChange(UINT uFlags, LPCTSTR lpszSection);
afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
afx_msg void OnTimer(UINT nIDEvent);
afx_msg void OnCancelMode();
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnKillFocus(CWnd* pNewWnd);
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
afx_msg UINT OnGetDlgCode();
afx_msg void OnRButtonDblClk(UINT nFlags, CPoint point);
afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
afx_msg void OnMButtonDblClk(UINT nFlags, CPoint point);
afx_msg void OnMButtonUp(UINT nFlags, CPoint point);
afx_msg void OnMButtonDown(UINT nFlags, CPoint point);
afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
//}}AFX_MSG
afx_msg LRESULT OnDisplayChange(WPARAM wParam, LPARAM lParam);
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
// CSettingsTreeWnd
const int CSettingsTreeWnd::g_nImgWidth = 36;
const int CSettingsTreeWnd::g_nImgHeight = 19;
CSettingsTreeWnd::CSettingsTreeWnd()
: m_imgList(
IDB_BITMAP_TREE_IMG_LIST,
RGB(255,0,255),
g_nImgWidth
)
#if (defined __SETTINGS_TREE_SUPPORTS_HOVER)
, m_htiMenuBoxHover( NULL )
#endif // (defined __SETTINGS_TREE_SUPPORTS_HOVER)
, m_htiPopupMenu( NULL )
, m_bRenderAlphaEffects( false )
{
ASSERT( m_imgList.GetSafeHandle() != NULL );
}
CSettingsTreeWnd::~CSettingsTreeWnd()
{
}
BEGIN_MESSAGE_MAP(CSettingsTreeWnd, CTreeCtrl)
//{{AFX_MSG_MAP(CSettingsTreeWnd)
ON_WM_ERASEBKGND()
ON_WM_PAINT()
ON_WM_SETTINGCHANGE()
ON_WM_SETCURSOR()
ON_WM_TIMER()
ON_WM_CANCELMODE()
ON_WM_MOUSEMOVE()
ON_WM_LBUTTONDBLCLK()
ON_WM_LBUTTONUP()
ON_WM_LBUTTONDOWN()
ON_WM_KEYDOWN()
ON_WM_KILLFOCUS()
ON_WM_HSCROLL()
ON_WM_VSCROLL()
ON_WM_MOUSEWHEEL()
ON_WM_GETDLGCODE()
ON_WM_RBUTTONDBLCLK()
ON_WM_RBUTTONUP()
ON_WM_RBUTTONDOWN()
ON_WM_MBUTTONDBLCLK()
ON_WM_MBUTTONUP()
ON_WM_MBUTTONDOWN()
ON_WM_CONTEXTMENU()
//}}AFX_MSG_MAP
ON_MESSAGE( WM_DISPLAYCHANGE, OnDisplayChange )
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSettingsTreeWnd message handlers
void CSettingsTreeWnd::PreSubclassWindow()
{
CTreeCtrl::PreSubclassWindow();
SetRedraw( FALSE );
// CTreeCtrl::SetImageList( &m_imgList, TVSIL_NORMAL );
// CTreeCtrl::SetImageList( &m_imgList, TVSIL_STATE );
CTreeCtrl::SetIndent( g_nImgWidth + 12 + 8 );
int nItemHeight = CTreeCtrl::GetItemHeight();
nItemHeight = max( nItemHeight, g_nImgHeight );
nItemHeight++;
CTreeCtrl::SetItemHeight( nItemHeight );
theApp.GetRootTaskNode()->OnTreeControlInit( *this );
SetRedraw( TRUE );
HTREEITEM hti = CTreeCtrl::GetNextItem( TVI_ROOT, TVGN_CHILD );
if( hti != NULL )
CTreeCtrl::SelectItem( hti );
}
BOOL CSettingsTreeWnd::OnEraseBkgnd(CDC* pDC)
{
// return CTreeCtrl::OnEraseBkgnd(pDC);
pDC;
return TRUE;
}
void CSettingsTreeWnd::ClientArea_PaintBackground( CDC & dc, CRect rcClient )
{
ASSERT_VALID( this );
dc.FillSolidRect( &rcClient, CTreeCtrl::GetBkColor() );
}
void CSettingsTreeWnd::ClientArea_PaintForeground( CDC & dc, CRect rcClient )
{
ASSERT_VALID( this );
rcClient;
int nVisibleCount = CTreeCtrl::GetVisibleCount() + 1;
if( nVisibleCount == 0 )
return;
CFont * pDefaultGuiFont = CTreeCtrl::GetFont();
ASSERT( pDefaultGuiFont->GetSafeHandle() != NULL );
CFont * pOldFont = dc.SelectObject( pDefaultGuiFont );
COLORREF clrOldTextColor = dc.GetTextColor();
int nOldBkMode = dc.SetBkMode( TRANSPARENT );
HTREEITEM htiDH = CTreeCtrl::GetDropHilightItem();
bool bFocusedControl = false;
HWND hWndFocus = ::GetFocus();
if( hWndFocus == m_hWnd
|| ::IsChild( m_hWnd, hWndFocus )
)
bFocusedControl = true;
INT nItemIndent = (INT)CTreeCtrl::GetIndent();
ASSERT( nItemIndent > 0 );
COLORREF clrTextDisabled = ::GetSysColor( COLOR_3DSHADOW );
COLORREF clrTextNorm = ::GetSysColor( COLOR_WINDOWTEXT );
COLORREF clrBkNorm = ::GetSysColor( COLOR_WINDOW );
ASSERT( !theApp.m_iconNodeCollapsed.IsEmpty() );
ASSERT( !theApp.m_iconNodeExpaded.IsEmpty() );
ASSERT( !theApp.m_iconNodeDot.IsEmpty() );
ASSERT( !theApp.m_iconNodeBlueCube.IsEmpty() );
for( HTREEITEM hti = CTreeCtrl::GetFirstVisibleItem();
hti != NULL && nVisibleCount > 0;
hti = CTreeCtrl::GetNextVisibleItem( hti ), nVisibleCount--
)
{ // walk all visible items
CTaskNode * pTaskNode = (CTaskNode *)
CTreeCtrl::GetItemData( hti );
ASSERT_VALID( pTaskNode );
ASSERT_KINDOF( CTaskNode, pTaskNode );
bool bEnabled = pTaskNode->IsActionAvailable();
INT nImgCheck = 0;
if( bEnabled )
{
INT nCheck = pTaskNode->Check();
ASSERT( 0 <= nCheck && nCheck <= 2 );
nImgCheck = nCheck << 1;
} // if( bEnabled )
else
nImgCheck = 6;
if(
#if (defined __SETTINGS_TREE_SUPPORTS_HOVER)
hti == m_htiMenuBoxHover
||
#endif // (defined __SETTINGS_TREE_SUPPORTS_HOVER)
hti == m_htiPopupMenu
)
nImgCheck++;
UINT nItemState =
CTreeCtrl::GetItemState(
hti,
TVIS_BOLD|TVIS_SELECTED|TVIS_DROPHILITED
);
CRect rcItemText, rcItemAll;
CTreeCtrl::GetItemRect( hti, &rcItemAll, FALSE );
CTreeCtrl::GetItemRect( hti, &rcItemText, TRUE );
dc.FillSolidRect( &rcItemAll, clrBkNorm );
// dc.FillSolidRect( &rcItemText, clrBk );
CRect rcImage(
stat_GetItemRectImpl(
__EGIRT_MENU_BOX,
rcItemText,
nItemIndent
)
);
m_imgList.Draw(
&dc,
nImgCheck,
rcImage.TopLeft(),
ILD_NORMAL
);
HTREEITEM htiChild =
CTreeCtrl::GetNextItem( hti, TVGN_CHILD );
if( htiChild != NULL )
{
bool bExpanded =
( (CTreeCtrl::GetItemState( hti, TVIS_EXPANDED ) & TVIS_EXPANDED) != 0 )
? true : false;
CExtCmdIcon & _icon =
bExpanded
? theApp.m_iconNodeExpaded
: theApp.m_iconNodeCollapsed
;
CSize _sizeIcon = _icon.GetSize();
CRect rcCollExpBmp(
stat_GetItemRectImpl(
__EGIRT_EXP_IMG,
rcItemText,
nItemIndent,
_sizeIcon.cx,
_sizeIcon.cy
)
);
_icon.Paint(
g_PaintManager.GetPM(),
dc,
rcCollExpBmp.left,
rcCollExpBmp.top,
-1,
-1
);
} // if( htiChild != NULL )
else
{
CExtCmdIcon & _icon = pTaskNode->GetIcon();
ASSERT( !_icon.IsEmpty() );
CSize _sizeIcon = _icon.GetSize();
CRect rcDot(
stat_GetItemRectImpl(
__EGIRT_EXP_IMG,
rcItemText,
nItemIndent,
_sizeIcon.cx,
_sizeIcon.cy
)
);
_icon.Paint(
g_PaintManager.GetPM(),
dc,
rcDot.left,
rcDot.top,
-1,
-1
);
} // else from if( htiChild != NULL )
CString strItemText = CTreeCtrl::GetItemText( hti );
int nItemTextLength = strItemText.GetLength();
ASSERT( nItemTextLength > 0 );
bool bFocusStyle = false;
if( ( nItemState & TVIS_DROPHILITED ) != 0 )
bFocusStyle = true;
else if( ( nItemState & TVIS_SELECTED ) != 0 && htiDH == NULL )
bFocusStyle = true;
COLORREF clrText = bEnabled ? clrTextNorm : clrTextDisabled;
COLORREF clrBk = clrBkNorm;
if( bFocusStyle )
{
if( bFocusedControl )
{
clrText =
::GetSysColor(
bEnabled ? COLOR_HIGHLIGHTTEXT : COLOR_3DFACE
);
clrBk =
::GetSysColor( COLOR_HIGHLIGHT );
} // if( bFocusedControl )
else
{
clrBk = ::GetSysColor( COLOR_3DFACE );
} // else from if( bFocusedControl )
} // if( bFocusStyle )
if( clrBk != clrBkNorm )
dc.FillSolidRect( &rcItemText, clrBk );
dc.SetTextColor( clrText );
if( (nItemState & TVIS_BOLD) != 0 )
{
if( m_fontBold.GetSafeHandle() == NULL )
{
LOGFONT _lf;
::memset( &_lf, 0, sizeof(LOGFONT) );
pDefaultGuiFont->GetLogFont( &_lf );
_lf.lfWeight = 700;
VERIFY( m_fontBold.CreateFontIndirect( &_lf ) );
} // if( m_fontBold.GetSafeHandle() == NULL )
if( m_fontBold.GetSafeHandle() != NULL )
dc.SelectObject( &m_fontBold );
} // if( (nItemState & TVIS_BOLD) != 0 )
dc.DrawText(
strItemText,
nItemTextLength,
&rcItemText,
DT_SINGLELINE|DT_CENTER|DT_VCENTER
);
dc.SelectObject( pDefaultGuiFont );
if( bFocusedControl && ( nItemState & TVIS_SELECTED ) != 0 )
{
dc.SetTextColor( clrText );
dc.DrawFocusRect( &rcItemText );
}
} // walk all visible items
dc.SetBkMode( nOldBkMode );
dc.SetTextColor( clrOldTextColor );
dc.SelectObject( pOldFont );
}
void CSettingsTreeWnd::OnPaint()
{
ASSERT( m_imgList.GetSafeHandle() != NULL );
CRect rcClient;
GetClientRect( &rcClient );
CPaintDC dcPaint( this );
CExtMemoryDC dc( &dcPaint, &rcClient );
if( m_bRenderAlphaEffects )
{
BITMAPINFOHEADER bih;
bih.biSize = sizeof(BITMAPINFOHEADER);
bih.biWidth = rcClient.Width();
bih.biHeight = rcClient.Height();
bih.biPlanes = 1;
bih.biBitCount = 32;
bih.biCompression = BI_RGB;
bih.biSizeImage = rcClient.Width() * rcClient.Height();
bih.biXPelsPerMeter = 0;
bih.biYPelsPerMeter = 0;
bih.biClrUsed = 0;
bih.biClrImportant = 0;
COLORREF * pDibSurface = NULL;
HBITMAP hDIB =
::CreateDIBSection(
dc.GetSafeHdc(),
(LPBITMAPINFO)&bih,
DIB_RGB_COLORS,
(void **)&pDibSurface,
NULL,
NULL
);
if( hDIB != NULL && pDibSurface != NULL )
{
CBitmap bmpBetterSurface;
bmpBetterSurface.Attach( hDIB );
CDC dcBetterSurface;
if( dcBetterSurface.CreateCompatibleDC( &dc ) )
{
CBitmap * pOldBmp = dcBetterSurface.SelectObject( &bmpBetterSurface );
ClientArea_PaintBackground( dc, rcClient );
// ClientArea_PaintBackground( dcBetterSurface, rcClient );
COLORREF clrTransparentFake = RGB(255,0,255);
dcBetterSurface.FillSolidRect( &rcClient, clrTransparentFake );
CTreeCtrl::DefWindowProc( WM_PAINT, (WPARAM)dcBetterSurface.GetSafeHdc(), 0L );
ClientArea_PaintForeground( dcBetterSurface, rcClient );
dcBetterSurface.SelectObject( pOldBmp );
CExtBitmap _bmpMaze;
if( _bmpMaze.FromBitmap( hDIB ) )
{
_bmpMaze.AlphaColor( clrTransparentFake, RGB(0,0,0), 0 );
CRect rcFrameTop(
rcClient.left,
rcClient.top,
rcClient.right,
rcClient.top + 1
);
CRect rcFrameBottom(
rcClient.left,
rcClient.bottom - 1,
rcClient.right,
rcClient.bottom
);
const INT nStepDY = 25;
const INT nAlphaRange = 32;
for( INT nStepY = 0; nStepY < nStepDY; nStepY ++ )
{
INT nAlpha = ::MulDiv( nStepY, nAlphaRange, nStepDY ) + 255 - nAlphaRange;
_bmpMaze.AlphaRect(
rcFrameTop,
nAlpha
);
_bmpMaze.AlphaRect(
rcFrameBottom,
nAlpha
);
rcFrameTop.OffsetRect( 0, 1 );
rcFrameBottom.OffsetRect( 0, -1 );
}
_bmpMaze.AlphaBlend( dc, rcClient );
return;
}
}
}
} // if( m_bRenderAlphaEffects )
CRect rcClip;
dcPaint.GetClipBox( &rcClip );
CRgn rgnClip;
rgnClip.CreateRectRgnIndirect( &rcClip );
dc.SelectClipRgn( &rgnClip );
//rgnClip.DeleteObject();
ClientArea_PaintBackground( dc, rcClient );
CTreeCtrl::DefWindowProc( WM_PAINT, (WPARAM)dc.GetSafeHdc(), 0L );
ClientArea_PaintForeground( dc, rcClient );
dc.SelectClipRgn( NULL );
}
CRect CSettingsTreeWnd::stat_GetItemRectImpl(
CSettingsTreeWnd::e_get_item_rect_impl_t eGIRT,
CRect rcItemText,
int nItemIndent,
int nExpImgWidth, // = 12
int nExpImgHeight, // = 12
int nMenuImgWidth, // = CSettingsTreeWnd::g_nImgWidth
int nMenuImgHeight // = CSettingsTreeWnd::g_nImgHeight
)
{
ASSERT( __EGIRT_MIN_VALUE <= eGIRT && eGIRT <= __EGIRT_MAX_VALUE );
CRect rcResult( rcItemText );
switch( eGIRT )
{
case __EGIRT_EXP_IMG:
rcResult.left -= nItemIndent;
rcResult.right = rcResult.left + nExpImgWidth;
rcResult.OffsetRect(
( nItemIndent - nMenuImgWidth - nExpImgWidth ) / 2,
( rcResult.Height() - nExpImgHeight ) / 2
);
break;
case __EGIRT_MENU_BOX:
rcResult.right = rcResult.left-2;
rcResult.left -= nMenuImgWidth+2;
break;
case __EGIRT_CHECK_BOX:
rcResult.right = rcResult.left-2;
rcResult.left -= nMenuImgWidth+2;
rcResult.left += 5;
rcResult.top += 3;
rcResult.right = rcResult.left + 12;
rcResult.bottom = rcResult.top + 12;
break;
case __EGIRT_ARROW:
rcResult.right = rcResult.left-2;
rcResult.left -= nMenuImgWidth+2;
rcResult.left += 22;
break;
#ifdef _DEBUG
default:
ASSERT( FALSE );
break;
#endif // _DEBUG
} // switch( eGIRT )
return rcResult;
}
void CSettingsTreeWnd::OnSettingChange(UINT uFlags, LPCTSTR lpszSection)
{
CTreeCtrl::OnSettingChange(uFlags, lpszSection);
if( m_fontBold.GetSafeHandle() != NULL )
m_fontBold.DeleteObject();
}
LRESULT CSettingsTreeWnd::OnDisplayChange(WPARAM wParam, LPARAM lParam)
{
LRESULT lResult = Default();
if( m_fontBold.GetSafeHandle() != NULL )
m_fontBold.DeleteObject();
return lResult;
}
BOOL CSettingsTreeWnd::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
ASSERT( theApp.m_hCursorHand != NULL );
CPoint point;
if( ::GetCursorPos( &point) )
{
ScreenToClient( &point );
UINT nHtFlags = 0;
HTREEITEM hti = CTreeCtrl::HitTest( point, &nHtFlags );
if( hti != NULL
&& (nHtFlags&(TVHT_ONITEMICON|TVHT_ONITEMLABEL|TVHT_ONITEMICON|TVHT_ONITEMSTATEICON|TVHT_ONITEMINDENT|TVHT_ONITEMBUTTON)) != 0
)
{
INT nItemIndent = (INT)CTreeCtrl::GetIndent();
ASSERT( nItemIndent > 0 );
CRect rcItemText;
CTreeCtrl::GetItemRect( hti, &rcItemText, TRUE );
HTREEITEM htiChild =
CTreeCtrl::GetNextItem( hti, TVGN_CHILD );
if( htiChild != NULL )
{
CRect rcCollExpBmp(
stat_GetItemRectImpl(
__EGIRT_EXP_IMG,
rcItemText,
nItemIndent
)
);
if( rcCollExpBmp.PtInRect(point) )
{
::SetCursor( theApp.m_hCursorHand );
return TRUE;
} // if( rcCollExpBmp.PtInRect(point) )
} // if( htiChild != NULL )
CTaskNode * pTaskNode = (CTaskNode *)
CTreeCtrl::GetItemData( hti );
ASSERT_VALID( pTaskNode );
ASSERT_KINDOF( CTaskNode, pTaskNode );
bool bEnabled = pTaskNode->IsActionAvailable();
if( bEnabled )
{
CRect rcCheckBox(
stat_GetItemRectImpl(
__EGIRT_CHECK_BOX,
rcItemText,
nItemIndent
)
);
if( rcCheckBox.PtInRect(point) )
{
::SetCursor( theApp.m_hCursorHand );
return TRUE;
} // if( rcCheckBox.PtInRect(point) )
CRect rcArrow(
stat_GetItemRectImpl(
__EGIRT_ARROW,
rcItemText,
nItemIndent
)
);
if( rcArrow.PtInRect(point) )
{
::SetCursor( theApp.m_hCursorHand );
return TRUE;
} // if( rcArrow.PtInRect(point) )
} // if( bEnabled )
}
} // if( ::GetCursorPos( &point) )
return CTreeCtrl::OnSetCursor(pWnd, nHitTest, message);
}
void CSettingsTreeWnd::OnTimer(UINT nIDEvent)
{
#if (defined __SETTINGS_TREE_SUPPORTS_HOVER)
if( nIDEvent == 0x333 )
{
if( m_htiMenuBoxHover == NULL
|| ( GetStyle() & WS_VISIBLE ) == 0
|| ( GetParent()->GetStyle() & WS_VISIBLE ) == 0
)
{
m_htiMenuBoxHover = NULL;
KillTimer( 0x333 );
return;
}
if( m_htiPopupMenu != NULL )
return;
CPoint point;
if( GetCursorPos(&point) )
{
CRect rcClient;
GetClientRect( &rcClient );
ClientToScreen( &rcClient );
if( rcClient.PtInRect(point) )
return;
} // if( GetCursorPos(&point) )
KillTimer( 0x333 );
CRect rcItemAll;
CTreeCtrl::GetItemRect( m_htiMenuBoxHover, &rcItemAll, FALSE );
m_htiMenuBoxHover = NULL;
InvalidateRect( &rcItemAll );
UpdateWindow();
return;
} // if( nIDEvent == 0x333 )
#endif // (defined __SETTINGS_TREE_SUPPORTS_HOVER)
CTreeCtrl::OnTimer(nIDEvent);
}
void CSettingsTreeWnd::OnCancelMode()
{
CTreeCtrl::OnCancelMode();
#if (defined __SETTINGS_TREE_SUPPORTS_HOVER)
KillTimer( 0x333 );
if( m_htiMenuBoxHover != NULL )
{
CRect rcItemAll;
CTreeCtrl::GetItemRect( m_htiMenuBoxHover, &rcItemAll, FALSE );
m_htiMenuBoxHover = NULL;
InvalidateRect( &rcItemAll );
UpdateWindow();
} // if( m_htiMenuBoxHover != NULL )
#endif // (defined __SETTINGS_TREE_SUPPORTS_HOVER)
}
void CSettingsTreeWnd::OnKillFocus(CWnd* pNewWnd)
{
CTreeCtrl::OnKillFocus(pNewWnd);
SendMessage( WM_CANCELMODE );
}
void CSettingsTreeWnd::_AnalyzeMenuButtonHover()
{
if( m_htiPopupMenu != NULL )
return;
HTREEITEM hti = NULL;
if( IsWindowEnabled() && GetFocus() == this )
{
CPoint point;
if( GetCursorPos(&point) )
{
ScreenToClient( &point );
UINT nHtFlags = 0;
hti = CTreeCtrl::HitTest( point, &nHtFlags );
if( hti != NULL
&& (nHtFlags&(TVHT_ONITEMICON|TVHT_ONITEMLABEL|TVHT_ONITEMICON|TVHT_ONITEMSTATEICON|TVHT_ONITEMINDENT|TVHT_ONITEMBUTTON)) != 0
)
{
CTaskNode * pTaskNode = (CTaskNode *)
CTreeCtrl::GetItemData( hti );
ASSERT_VALID( pTaskNode );
ASSERT_KINDOF( CTaskNode, pTaskNode );
INT nItemIndent = (INT)CTreeCtrl::GetIndent();
ASSERT( nItemIndent > 0 );
CRect rcItemText;
CTreeCtrl::GetItemRect( hti, &rcItemText, TRUE );
CRect rcMenuBox(
stat_GetItemRectImpl(
__EGIRT_MENU_BOX,
rcItemText,
nItemIndent
)
);
if( !rcMenuBox.PtInRect(point) )
hti = NULL;
}
} // if( GetCursorPos(&point) )
} // if( IsWindowEnabled() && GetFocus() == this )
#if (defined __SETTINGS_TREE_SUPPORTS_HOVER)
if( m_htiMenuBoxHover != hti )
{
if( m_htiMenuBoxHover != NULL )
{
CRect rcItemAll;
CTreeCtrl::GetItemRect( m_htiMenuBoxHover, &rcItemAll, FALSE );
InvalidateRect( &rcItemAll );
} // if( m_htiMenuBoxHover != NULL )
m_htiMenuBoxHover = hti;
if( m_htiMenuBoxHover != NULL )
{
CRect rcItemAll;
CTreeCtrl::GetItemRect( m_htiMenuBoxHover, &rcItemAll, FALSE );
InvalidateRect( &rcItemAll );
SetTimer( 0x333, 10, NULL );
} // if( m_htiMenuBoxHover != NULL )
else
KillTimer( 0x333 );
UpdateWindow();
} // if( m_htiMenuBoxHover != hti )
#endif // (defined __SETTINGS_TREE_SUPPORTS_HOVER)
}
void CSettingsTreeWnd::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
CTreeCtrl::OnHScroll(nSBCode, nPos, pScrollBar);
_AnalyzeMenuButtonHover();
}
void CSettingsTreeWnd::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
CTreeCtrl::OnVScroll(nSBCode, nPos, pScrollBar);
_AnalyzeMenuButtonHover();
}
BOOL CSettingsTreeWnd::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
{
BOOL bRetVal = CTreeCtrl::OnMouseWheel(nFlags, zDelta, pt);
_AnalyzeMenuButtonHover();
return bRetVal;
}
void CSettingsTreeWnd::OnMouseMove(UINT nFlags, CPoint point)
{
_AnalyzeMenuButtonHover();
CTreeCtrl::OnMouseMove(nFlags, point);
}
void CSettingsTreeWnd::OnLButtonDblClk(UINT nFlags, CPoint point)
{
// CTreeCtrl::OnLButtonDblClk(nFlags, point);
nFlags;
if( GetFocus() != this )
SetFocus();
UINT nHtFlags = 0;
HTREEITEM hti = CTreeCtrl::HitTest( point, &nHtFlags );
if( hti == NULL
|| (nHtFlags&(TVHT_ONITEMICON|TVHT_ONITEMLABEL|TVHT_ONITEMICON|TVHT_ONITEMSTATEICON|TVHT_ONITEMINDENT|TVHT_ONITEMBUTTON)) == 0
)
return;
HTREEITEM htiSel = CTreeCtrl::GetSelectedItem();
if( htiSel != hti )
CTreeCtrl::SelectItem( hti );
INT nItemIndent = (INT)CTreeCtrl::GetIndent();
ASSERT( nItemIndent > 0 );
CRect rcItemText;
CTreeCtrl::GetItemRect( hti, &rcItemText, TRUE );
if( !rcItemText.PtInRect(point) )
return;
CTaskNode * pTaskNode = (CTaskNode *)
CTreeCtrl::GetItemData( hti );
ASSERT_VALID( pTaskNode );
ASSERT_KINDOF( CTaskNode, pTaskNode );
bool bEnabled = pTaskNode->IsActionAvailable();
if( !bEnabled )
return;
int nCheck = pTaskNode->Check();
if( nCheck != 1 )
nCheck = 1;
else
nCheck = 0;
pTaskNode->Check( nCheck );
Invalidate();
UpdateWindow();
DoUpdateNextAvail();
}
void CSettingsTreeWnd::OnLButtonUp(UINT nFlags, CPoint point)
{
// CTreeCtrl::OnLButtonUp(nFlags, point);
nFlags;
point;
}
void CSettingsTreeWnd::OnLButtonDown(UINT nFlags, CPoint point)
{
// CTreeCtrl::OnLButtonDown(nFlags, point);
nFlags;
if( GetFocus() != this )
SetFocus();
UINT nHtFlags = 0;
HTREEITEM hti = CTreeCtrl::HitTest( point, &nHtFlags );
if( hti == NULL
|| (nHtFlags&(TVHT_ONITEMICON|TVHT_ONITEMLABEL|TVHT_ONITEMICON|TVHT_ONITEMSTATEICON|TVHT_ONITEMINDENT|TVHT_ONITEMBUTTON)) == 0
)
return;
HTREEITEM htiSel = CTreeCtrl::GetSelectedItem();
if( htiSel != hti )
CTreeCtrl::SelectItem( hti );
INT nItemIndent = (INT)CTreeCtrl::GetIndent();
ASSERT( nItemIndent > 0 );
CRect rcItemText;
CTreeCtrl::GetItemRect( hti, &rcItemText, TRUE );
HTREEITEM htiChild =
CTreeCtrl::GetNextItem( hti, TVGN_CHILD );
if( htiChild != NULL )
{
CRect rcCollExpBmp(
stat_GetItemRectImpl(
__EGIRT_EXP_IMG,
rcItemText,
nItemIndent
)
);
if( rcCollExpBmp.PtInRect(point) )
{
CTreeCtrl::Expand( hti, TVE_TOGGLE );
return;
} // if( rcCollExpBmp.PtInRect(point) )
} // if( htiChild != NULL )
CTaskNode * pTaskNode = (CTaskNode *)
CTreeCtrl::GetItemData( hti );
ASSERT_VALID( pTaskNode );
ASSERT_KINDOF( CTaskNode, pTaskNode );
bool bEnabled = pTaskNode->IsActionAvailable();
if( !bEnabled )
return;
CRect rcCheckBox(
stat_GetItemRectImpl(
__EGIRT_CHECK_BOX,
rcItemText,
nItemIndent
)
);
if( rcCheckBox.PtInRect(point) )
{
int nCheck = pTaskNode->Check();
if( nCheck != 1 )
nCheck = 1;
else
nCheck = 0;
pTaskNode->Check( nCheck );
Invalidate();
UpdateWindow();
DoUpdateNextAvail();
return;
} // if( rcCheckBox.PtInRect(point) )
CRect rcArrow(
stat_GetItemRectImpl(
__EGIRT_ARROW,
rcItemText,
nItemIndent
)
);
if( rcArrow.PtInRect(point) )
{
_TrackItemMenu( hti );
return;
} // if( rcArrow.PtInRect(point) )
}
void CSettingsTreeWnd::OnMButtonDblClk(UINT nFlags, CPoint point)
{
// CTreeCtrl::OnMButtonDblClk(nFlags, point);
OnLButtonDblClk( nFlags, point );
}
void CSettingsTreeWnd::OnMButtonUp(UINT nFlags, CPoint point)
{
// CTreeCtrl::OnMButtonUp(nFlags, point);
nFlags;
point;
}
void CSettingsTreeWnd::OnMButtonDown(UINT nFlags, CPoint point)
{
// CTreeCtrl::OnMButtonDown(nFlags, point);
nFlags;
point;
}
void CSettingsTreeWnd::OnRButtonDblClk(UINT nFlags, CPoint point)
{
// CTreeCtrl::OnRButtonDblClk(nFlags, point);
OnLButtonDblClk( nFlags, point );
}
void CSettingsTreeWnd::OnRButtonUp(UINT nFlags, CPoint point)
{
// CTreeCtrl::OnRButtonUp(nFlags, point);
nFlags;
point;
}
void CSettingsTreeWnd::OnRButtonDown(UINT nFlags, CPoint point)
{
// CTreeCtrl::OnRButtonDown(nFlags, point);
nFlags;
if( GetFocus() != this )
SetFocus();
UINT nHtFlags = 0;
HTREEITEM hti = CTreeCtrl::HitTest( point, &nHtFlags );
if( hti == NULL
|| (nHtFlags&(TVHT_ONITEMICON|TVHT_ONITEMLABEL|TVHT_ONITEMICON|TVHT_ONITEMSTATEICON|TVHT_ONITEMINDENT|TVHT_ONITEMBUTTON)) == 0
)
return;
HTREEITEM htiSel = CTreeCtrl::GetSelectedItem();
if( htiSel != hti )
CTreeCtrl::SelectItem( hti );
INT nItemIndent = (INT)CTreeCtrl::GetIndent();
ASSERT( nItemIndent > 0 );
CRect rcItemText;
CTreeCtrl::GetItemRect( hti, &rcItemText, TRUE );
CTaskNode * pTaskNode = (CTaskNode *)
CTreeCtrl::GetItemData( hti );
ASSERT_VALID( pTaskNode );
ASSERT_KINDOF( CTaskNode, pTaskNode );
bool bEnabled = pTaskNode->IsActionAvailable();
if( !bEnabled )
return;
_TrackItemMenu( hti );
}
void CSettingsTreeWnd::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
HTREEITEM hti = CTreeCtrl::GetSelectedItem();
if( hti != NULL )
{
if( nChar == VK_SPACE )
{
CTaskNode * pTaskNode = (CTaskNode *)
CTreeCtrl::GetItemData( hti );
ASSERT_VALID( pTaskNode );
ASSERT_KINDOF( CTaskNode, pTaskNode );
bool bEnabled = pTaskNode->IsActionAvailable();
if( !bEnabled )
return;
int nCheck = pTaskNode->Check();
if( nCheck != 1 )
nCheck = 1;
else
nCheck = 0;
pTaskNode->Check( nCheck );
Invalidate();
UpdateWindow();
DoUpdateNextAvail();
return;
} // if( nChar == VK_SPACE )
if( nChar == VK_RETURN )
{
CTaskNode * pTaskNode = (CTaskNode *)
CTreeCtrl::GetItemData( hti );
ASSERT_VALID( pTaskNode );
ASSERT_KINDOF( CTaskNode, pTaskNode );
bool bEnabled = pTaskNode->IsActionAvailable();
if( !bEnabled )
return;
_TrackItemMenu( hti, true );
} // if( nChar == VK_RETURN )
} // if( hti != NULL )
CTreeCtrl::OnKeyDown(nChar, nRepCnt, nFlags);
}
void CSettingsTreeWnd::DoUpdateNextAvail()
{
CPageSettings * pPageSettings = (CPageSettings *)
GetParent();
pPageSettings->DoUpdateNextAvail();
}
void CSettingsTreeWnd::_TrackItemMenu(
HTREEITEM hti,
bool bSelectAny // = false
)
{
ASSERT( hti != NULL );
CPoint point;
if( !GetCursorPos(&point) )
{
ASSERT( FALSE );
return;
}
if( m_htiPopupMenu != NULL
|| CExtPopupMenuWnd::IsMenuTracking()
)
{
CExtPopupMenuWnd::CancelMenuTracking();
return;
} // if( m_htiPopupMenu != NULL )
CRect rcItemText;
CTreeCtrl::GetItemRect( hti, &rcItemText, TRUE );
INT nItemIndent = (INT)CTreeCtrl::GetIndent();
ASSERT( nItemIndent > 0 );
CRect rcMenuBox(
stat_GetItemRectImpl(
__EGIRT_MENU_BOX,
rcItemText,
nItemIndent
)
);
ClientToScreen( &rcMenuBox );
CTaskNode * pTaskNode = (CTaskNode *)
CTreeCtrl::GetItemData( hti );
ASSERT_VALID( pTaskNode );
ASSERT_KINDOF( CTaskNode, pTaskNode );
bool bEnabled = pTaskNode->IsActionAvailable();
if( !bEnabled )
return;
CExtPopupMenuWnd * pPopup = new CExtPopupMenuWnd;
if( !pPopup->CreatePopupMenu( m_hWnd ) )
{
ASSERT( FALSE );
delete pPopup;
return;
}
CTaskNode::CTaskNodeArray arrMenuCmds;
pTaskNode->OnPopupMenuInit(
pPopup,
arrMenuCmds
);
if( arrMenuCmds.GetSize() == 0 )
{
ASSERT( FALSE );
delete pPopup;
return;
}
m_htiPopupMenu = hti;
DWORD dwTrackFlags =
TPMX_NO_WM_COMMAND|TPMX_NO_CMD_UI|TPMX_DO_MESSAGE_LOOP
|TPMX_TOPALIGN;
if( bSelectAny )
dwTrackFlags |= TPMX_SELECT_ANY;
UINT nResultCmdID = 0;
if( !pPopup->TrackPopupMenu(
dwTrackFlags,
point.x,
point.y,
&rcMenuBox,
NULL,
NULL,
&nResultCmdID
)
)
{
ASSERT( FALSE );
delete pPopup;
}
else if( nResultCmdID != 0 )
{
nResultCmdID --;
ASSERT( nResultCmdID < ((UINT)arrMenuCmds.GetSize()) );
pTaskNode = arrMenuCmds[ nResultCmdID ];
ASSERT_VALID( pTaskNode );
ASSERT_KINDOF( CTaskNode, pTaskNode );
bool bEnabled = pTaskNode->IsActionAvailable();
if( bEnabled )
{
int nCheck = pTaskNode->Check();
if( nCheck != 1 )
nCheck = 1;
else
nCheck = 0;
pTaskNode->Check( nCheck );
Invalidate();
UpdateWindow();
DoUpdateNextAvail();
} // if( bEnabled )
} // else if( nResultCmdID != 0 )
m_htiPopupMenu = NULL;
Invalidate();
_AnalyzeMenuButtonHover();
UpdateWindow();
}
UINT CSettingsTreeWnd::OnGetDlgCode()
{
UINT nDlgCode = CTreeCtrl::OnGetDlgCode();
nDlgCode |= DLGC_WANTALLKEYS;
return nDlgCode;
}
void CSettingsTreeWnd::OnContextMenu(CWnd* pWnd, CPoint point)
{
pWnd;
point;
HTREEITEM hti = CTreeCtrl::GetSelectedItem();
if( hti == NULL )
return;
CTaskNode * pTaskNode = (CTaskNode *)
CTreeCtrl::GetItemData( hti );
ASSERT_VALID( pTaskNode );
ASSERT_KINDOF( CTaskNode, pTaskNode );
bool bEnabled = pTaskNode->IsActionAvailable();
if( !bEnabled )
return;
_TrackItemMenu( hti, true );
}
And here is the problem I am facing:
1. Not able to understand the functionality of ClientArea_PaintBackground and ClientArea_PaintForeground the method OnPaint () and how is it helping in highlighting each individual tree item.
2. What is the value retrieved by GetClientRect (&client) in the method OnPaint ();
3. Where the declaration for CTaskNode and what is is it used for?
4. For highlighting individual items do we require only the method OnPaint () or do we also require the method BOOL CSettingsTreeWnd::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
Kindly guide me and address my issues.
Thank you
|
|
Technical Support
|
Aug 29, 2007 - 1:48 PM
|
We have provided you with the source code of the custom painted tree control from the task page of our Integration Wizard. This tree class cannot be used as is. You should not try insert it into your project as is. You should simply take a look at its implementation as a sample. The OnPaint() method contains most of all you need: it demonstrates how to walk through the visible tree items and over-paint them with custom look. Besides this task is a bit outside Prof-UIS. If it’s difficult for you to code similar tree control, then you can set us a custom work request. This will take a only a few hours and not a problem for us.
|
|