Subject |
Author |
Date |
|
Chris Anderson
|
Sep 11, 2007 - 10:13 AM
|
I’m wondering whether I can do the same thing with prof-ui as what we did in a legacy app. Basically What we did is : 1. create a MDI frame window 2. create a win32 dialog window ( and its children ) 3. subclass the win32 dialog window with a class derived from CControlBar 4. now you can dock the dialog window inside the MDI frame window
During the migration, we created the MDI frame window as a CFrameWnd, and subclassed the win32 dialog window with a class derived from CExtWA < CExtNCW<CWnd> >. Is it doable to somehow dock a window like this? Do you have any recommendation ?
Thanks
|
|
Chris Anderson
|
Sep 12, 2007 - 5:53 PM
|
this child/parent approach seem to be working, I can dock the dialog window while all the controls on the dialog box still works. This is great.
One question: there is a title bar on the mini frame window, is there any way to turn this off ? I tried different styles of the CExtControlBar but not able to get rid of it, any suggestion ?
Thanks
|
|
Technical Support
|
Sep 13, 2007 - 6:02 AM
|
You can create a control bar without the CBRS_GRIPPER style or remove this style from the control bar that has already been created. As a result the caption of the floating mini frame and the caption of the docked control bar will disappear. This is the same as overriding the CExtControlBar::IsBarWithGripper() virtual method and returning false from it. We have no ready-to-use option for removing the floating mini frame’s caption only. Besides a control bar without the caption is unusable and the user will be unable to redock it.
|
|
Technical Support
|
Sep 11, 2007 - 12:09 PM
|
The CExtControlBar window requires only one window to be created as its child window and it resizes this child so that the child window is stretched to cover the entire client area of the control bar. So your approach of subclassing is not applicable, probably even if your native Win32 dialog window contains only one child control. Please simply create your win32 dialog as a child of the CExtControlBar window or move it into this control bar using the SetParent() API.
|
|
Chris Anderson
|
Sep 11, 2007 - 2:48 PM
|
thanks, I just looked at SDI_dynamicbars sample, it’s the same approach, a CExtDynamicBar as the parent
|
|
Technical Support
|
Sep 12, 2007 - 12:26 PM
|
In the case of dynamic control bars, you should also create your window as a child of the dynamic control bar.
|
|
David Skok
|
Sep 11, 2007 - 8:54 AM
|
I have a question similar to thread: http://www.prof-uis.com/forum2.aspx?CID=40# regarding updating property cells.
I use a property grid in my application. I would like to include include read only items in some property sheets along side items that can be changed by the user. The read only items that I refer to are real time status such as counters and time values. I found if I change the property store then call PropertyStoreSynchronize() it reloads the grid as you indicated. I then tried to get at the "cloned" cells within the CExtPropertyGridWnd and cannot find them. I tried the following:
CExtPropertyGridControl *pPGC ... pointer to my grid control loaded with my property store
CExtPropertyGridWnd *pGW = pPGC->GetActiveGrid();
// A simplified example to show what I tried...
HTREEITEM htItem = pGW->ItemGetRoot(); htItem = pGW->ItemGetFirstChild( htItem );
// I assume that column 1 is the property data cell CExtGridCell *pCell = pGW->ItemGetCell( htItem, 1, 0, 0, false, false );
pCell does not point to a cell of type that I use in the property store!! How can I get the address of the cell in the grid so that I can update it?
|
|
Technical Support
|
Sep 11, 2007 - 10:56 AM
|
You are trying to get a grid cell which corresponds to some property value in the active tree grid only. But the property grid control typically contains more than one tree grid (two by default: categorized and sorted). Besides, it is not a good idea to use HTREEITEM based APIs because the tree structure can be changed during development after adding/removing property values and categories in the property store. So, we would recommend to use simpler and safer code like this: CExtPropertyGridCtrl * pPGC = . . .
CExtPropertyValue * pPV = . . . // your counter or timer property value
CExtGridCell * pCellSrc = pPV->ValueActiveGet();
ASSERT_VALID( pCellSrc );
// We assume your code has changed the active grid cell inside pPV
// (which is pCellSrc) here. This corresponds to the timer/counter
// changing action.
// In the case of timers and counters, you have reason to assign
// default value from active one. This will disable the Reset command
// in context menu for it. We guess timers and counters
// should not be editable too:
pCellSrc->ModifyStyle( __EGCS_READ_ONLY );
pPV->ValueDefaultFromActive();
// Now time to update this property value in all pPGC:
CTypedPtrArray < CPtrArray, CExtPropertyGridWnd * > arrGrids;
pPGC->OnPgcQueryGrids( arrGrids );
INT nGridIdx = 0;
for( ; nGridIdx < arrGrids.GetSize(); nGridIdx ++ )
{
CExtPropertyGridWnd * pGrid = arrGrids[ nGridIdx ];
ASSERT_VALID( pGrid );
// Get HTREEITEM handle which corresponds to
// the pPV property value:
HTREEITEM hTreeItem = pGrid->PropertyItemToTreeItem( pPV );
if( hTreeItem == NULL )
continue;
// Get the destination grid cell which is cloned from
// the active cell of the pPV property value:
CExtGridCell * pCellDst = pGrid->ItemGetCell( hTreeItem, 1 );
if( pCellDst == NULL )
continue;
ASSERT_VALID( pCellDst );
// Update destination grid cellās value:
pCellDst->Assign( *pCellSrc );
// Repaint required part of the tree grid:
if( ! pGrid->IsWindowVisible() )
continue;
LONG nRowNo = pGrid->ItemGetVisibleIndexOf( hTreeItem );
if( nRowNo < 0 )
continue;
CRect rc;
if( pGrid->GridCellRectsGet(
1,
nRowNo,
0,
0,
NULL,
&rc
)
)
{
CRect rcClient;
pGrid->GetClientRect( &rcClient );
rc.left = rcClient.left;
rc.right = rcClient.right;
pGrid->InvalidateRect( &rc );
}
}
|
|
David Skok
|
Sep 11, 2007 - 1:15 PM
|
Thank you, this is exactly what I was looking for.
You were correct in assuming that timers/counter cells should be read only. I have found that despite setting them to __EGCS_READ_ONLY the inplace editor is still invoked when the property value is selected and clicked. It is not possible to enter text or numbers however you can use left and right cursor keys to move the cursor and use delete key to remove characters. I assume this is a bug. This behavior is also exhibited in the PropertyGrid sample as follows: Start the PropertyGrid sample. Display the properties of a single button. Scroll down to the Handle property which is supposed to be read only. Do a left mouse click on the Handle property value. Notice that the inplace editor is created. Use the left arrow key to move the cursor into the handle value. Press the delete key to remove some characters. Press enter to accept the value.
|
|
Technical Support
|
Sep 11, 2007 - 1:44 PM
|
The editing of the read-only cell problem is fixed in the latest source code you can request by email. The read-only cells have in-place editor, but it must be read-only too. You can disable in-place editor activation using the following code: pCellSrc->ModifyStyle( __EGCS_NO_INPLACE_CONTROL ); or, in the case of your timers and counters: pCellSrc->ModifyStyle( __EGCS_READ_ONLY | __EGCS_NO_INPLACE_CONTROL );
|
|
tera t
|
Sep 10, 2007 - 10:55 PM
|
Hello.
In the PC which WindowsXP was put on. When a theme becomes Windows classical. ttp://profuis0.tripod.com/20070911/image01.jpg
I want to acquire the theme. I do not understand a method of the theme acquisition.
Please teach it. I am troubled. Thank you.
|
|
tera t
|
Sep 13, 2007 - 6:29 PM
|
Hello.
>I do not come in IsControlsThemed in a judgment of a theme. >>Then create the manifest_x86.xml text file in the same folder with the .rc2 file. This XML file should have the following content: >I do not work even if attached in these resources
About this matter. I ask for an answer.
Thank you.
|
|
tera t
|
Sep 12, 2007 - 11:52 PM
|
Hello.
I do not come in IsControlsThemed in a judgment of a theme.
>Then create the manifest_x86.xml text file in the same folder with the .rc2 file. This XML file should have the following content: I do not work even if attached in these resources
IsThemeActive worked well. (--;
|
|
tera t
|
Sep 11, 2007 - 7:51 PM
|
|
|
Technical Support
|
Sep 12, 2007 - 12:52 PM
|
If we correctly understood you, you need to know when the controls should be drawn in the classic mode or using the theme API.
If yes, you can use the following code: if( g_PaintManager.m_UxTheme.IsControlsThemed() )
{
// THEMED MODE
}
else
{
// CLASSIC MODE
}
|
|
Technical Support
|
Sep 11, 2007 - 9:23 AM
|
You can determine which standard Windows XP theme is set using the following code: CExtPaintManager::e_system_theme_t eST = g_PaintManager->OnQuerySystemTheme();
switch( eST )
{
case CExtPaintManager::ThemeLunaBlue:
::AfxMessageBox( _T("Luna Blue") );
break;
case CExtPaintManager::ThemeLunaOlive:
::AfxMessageBox( _T("Luna Olive") );
break;
case CExtPaintManager::ThemeLunaSilver:
::AfxMessageBox( _T("Luna Silver") );
break;
case CExtPaintManager::ThemeUnknown:
::AfxMessageBox( _T("Other") );
break;
} If you want to do this using the theme APIs provided with Windows XP or later, you should use the approach demonstrated in the CExtPaintManager::CExtPaintManagerAutoPtr::InitUserExApi() method.
|
|
tera t
|
Sep 10, 2007 - 7:47 PM
|
Hello.
When I use CExtPaintManagerOffice2007_R1. A change of the Window frame which I used CExtPaintManagerOffice2007_R1 for takes time. Why will it be so late?
|
|
Technical Support
|
Sep 11, 2007 - 9:20 AM
|
This is because it takes some time to load all the bitmaps used in the theme 2007 and because of heavy assertion statements we use everywhere. The release version is much faster because there are no assertions in it.
|
|
tera t
|
Sep 10, 2007 - 7:42 PM
|
Hello.
In CExtGridWnd, I want to acquire the number of the dots doing horizontal scrolling. Please teach an acquisition method of horizontal scrolling width
|
|
tera t
|
Sep 11, 2007 - 8:53 PM
|
|
|
Technical Support
|
Sep 12, 2007 - 12:23 PM
|
If you are using Windows scroll bars, just use the GetScrollBarInfo() Win32 API to get information about different parts of the scroll bar.
In the case of CExtScrollBar or CExtZoomScrollBar , you can use the following code: CExtScrollBar * pScrollBar = . . .
CExtPaintManager::PAINTSCROLLBARDATA _psbd( pScrollBar ); The CExtPaintManager::PAINTSCROLLBARDATA class has several CRect members describing the location and size of scroll bar’s parts.
|
|
Suhai Gyorgy
|
Sep 11, 2007 - 4:52 AM
|
You should override CExtScrollItemWnd::OnSwGetLineSize method (CExtGridWnd is derived from CExtScrollItemWnd class, so overriding is possible). Check out default implementation and change it as you need in your overriden method.
|
|
Andrew Moulden
|
Sep 10, 2007 - 3:00 PM
|
Hi,
I’ve been trying to implement a cell editor for 64-bit (double) floating point values in a CExtPropertyGridCtrl. The properties I’m working with have arbitrary precision based on the type of property I’m dealing with. I’d like to use the CExtGridCellUpDown class for my implementation due to the ease with which values can be altered via the mouse wheel or up/down keys.
I’ve come across two basic problems:
1) Due to FP precision issues, the default CExtGridCellUpDown implementation looks buggy to the user (even though it isn’t) because values may not appear as they expect. For example, in the ProfUIS-Controls Grid sample type 10.312 into row 2 of the ’UpDown’ column (or Variant col) and start decrementing the spinner. When it hits 0.312 it actually displays 0.319999999999999 (which to the user looks like 99999999999 because they can’t see the leading part of the number).
2) There’s no fixed precision. At times I’d like a set number of places after the decimal point, which looks tidier anyway when spinners are being used. Even more problematic for me is that decimal values which lie on an integer boundary display as integers (i.e no decimal point shown) which means there is often no way for a user to distinguish a float property from an int.
The way I tried to solve this was to do the following:
a) When Apply() is called on my CExtPropertyValue class, format the Variant->dblVal myself using _snprintf to get the precision I want b) Call atof on the resultant string and set the inplace Variant->dblVal (and ValueActive) to the returned value c) Call TextSet on the inplace control and ValueActive with my formatted string
This has solved the precision problems with the spinners, but the inplace cell is still truncating any trailing zeros and still removing the decimal point if the double value happens to be an integer.
So, that’s my question: How do I force the grid cell to display a decimal point and as many places as I want after the decimal point? Is there an easy way? Or can I somehow use the CExtGridCellNumber class with up/down spinners, including keyboard/mouse wheel functionality?
Thanks for your time.
|
|
Andrew Moulden
|
Sep 16, 2007 - 3:47 PM
|
Okay, I’ve now got the functionality I need by using the recommendation you made in your first reply - using TextGet() to do the formatting. I’ve extended CExtGridCellString with the up/down buttons as a bool property which means I can use this class for all my floating point properties, irrespective of whether or not spin buttons are required. For mouse wheel and keyboard functionality I simply cut and pasted the code from the CExtGridCellUpDown source.
I’d already tried to implement the class in this way before I contacted support, but I couldn’t understand why the inplace cell text wasn’t updating when I called TextSet() with my formatted string.
A final point about some odd painting behaviour I came across (not just in my class but in the vanilla CExtGridCellUpDown):
Let’s say I have a CExtGridCellUpDown in a property grid and the user increments the value with an ’up’ spin button. The user then clicks undo from the toolbar. I have to implement that undo with the minimum of effort, and so I followed some advice you gave in another thread about using OnPgcQueryGrids() to locate the relevant cell and change the value. This works fine, but when the cell is updated and repainted, the ’up’ spin button now draws in its pressed state (darker colour). Nothing you now do will change that pressed state until you actually press the button again. You can go to another cell to remove focus, but when you return the button still paints as pressed. It’s even possible to make both buttons paint as pressed simultaneously by decrementing the cell value and then calling undo again.
There may be some simple explanation for this, but I simply hacked a fix by calling...
pCellDst->ModifyStyle(0, EGCS_PRESSED_UP); pCellDst->ModifyStyle(0, EGCS_PRESSED_DOWN);
...in my cell update method. All the same, if I’m doing something wrong please let me know.
Cheers,
Andrew
|
|
Andrew Moulden
|
Sep 14, 2007 - 12:33 PM
|
Thanks for your efforts and response on this, guys.
I’ve been on vacation for the last three days which is why I didn’t respond earlier to your replies. I’ll be looking at this in detail again on Monday, but at first glance the solution you’ve come up with is an excellent one. The class hierarchy is far more logical and comprehensive now.
Again, thanks for your support.
|
|
Technical Support
|
Sep 13, 2007 - 8:05 AM
|
In response to your request, we did the following:
1) changed the base class of CExtGridCellUpDown to CExtGridCellNumber 2) moved the functionality of CExtGridCellUpDown to CExtGridCellVariant so this functionality is now available in all the derived cell classes including CExtGridCellNumber .
You can turn on the up/down functionality in CExtGridCellNumber by applying the __EGCS_BUTTON_UPDOWN cell style. If you need this update right now, please contact us via email.
|
|
Technical Support
|
Sep 11, 2007 - 1:48 PM
|
1. Actually we do not use some specific realization of double values operations. The CExtGridCellUpDown() class is based on the VARIANT type and all the operations are performed using the VARIANT API.
2. Did you try the CExtGridCellNumber::SetNumDigits() method? You can override the CExtGridCellUpDown::TextGet() method and implement your formatting yourself.
3. Yes you can create your own class derived from CExtGridCellNumber and copy two virtual methods there, which you can find in OnInplaceControlPreTranslateMessage() and _DoValueIterate() . Do not forget to apply the __EGCS_BUTTON_UPDOWN cell style.
So, it seems you need to create some CExtGridCellNumberUpDown class. Actually, after answering your questions we decided to add such a class into Prof-UIS ourselves. So please let us know your thoughts.
|
|
Malcolm D
|
Sep 9, 2007 - 6:02 PM
|
I have been trying to work out how to avoid calling PropertyStoreSyncronizeAll, and also how to miminse the effect it has when being called.
Previous dialog has occured at the following link, though I didn’t get all my questions answered: http://www.prof-uis.com/Forum_View.aspx?CID=29&M=56525&s=synchronise
The main question I would like answered is as following. When PropertyStoreSyncronizeAll gets called, the tree window scrolls to the top, the currently selected item is unselected, including any inplace controls hiding. Is there any way to get the information and restore it (as much as possible) after the call to PropertyStoreSyncronizeAll?
Thanks
|
|
Malcolm D
|
Sep 12, 2007 - 4:53 PM
|
I am not sure how this functions as a features request. I guess, yes, that if I could have something that performed perfectly then it would be a features request. Well until I get that thing, I am hoping for something else, as I mentioned in the first post:
"When PropertyStoreSyncronizeAll gets called, the tree window scrolls to the top, the currently selected item is unselected, including any inplace controls hiding. Is there any way to get the information and restore it (as much as possible) after the call to PropertyStoreSyncronizeAll?" i.e. get and restore the current scroll position, get and resotre the currently selected item etc.
In relation to the invisible rows - I have been using a mechanism that is already available in 2.7 (or possibly earlier). As I said in the previous thread of posts, the very use of this current mechanism guarantees you will have the problem. I.E. to hide or show the items a call to PropertyStoreSyncronizeAll must be made, hence we get the problem.
|
|
Technical Support
|
Sep 13, 2007 - 5:58 AM
|
You can restore the scrolling position using the following code: CExtPropertyGridCtrl * pPGC = . . .
CExtPropertyGridWnd * pPGW = pPGC->GetActiveGrid();
ASSERT_VALID( pPGW );
pPGW->SetRedraw( FALSE );
CPoint ptScroll = pPGW->OnSwGetScrollPos ();
// change the property store here . . .
pPGC->PropertyStoreSynchronize();
pPGW->OnSwSetScrollPos( ptScroll );
pPGW->SetRedraw( TRUE ); But this method is still based on the existing CExtPropertyGridCtrl::PropertyStoreSynchronize() method which re-initializes the tree grid windows inside the property grid control completely. We think this task should be really solved by coding a new synchronization method which assumes the property tree store is not changed but some property values/categories in it have changed their visibility state.
|
|
Malcolm D
|
Sep 11, 2007 - 6:17 PM
|
As I mention in the first post I have already asked this question, and also aswered your question in http://www.prof-uis.com/Forum_View.aspx?CID=29&M=56525 (the link might have been broken in the previous post)
The main reason I am calling PropertyStoreSyncronizeAll is that I need to change the visibility of some items via an overloaded "CExtPropertyGridCell::CanBeInsertedIntoPropertyGrid", so in the Apply function I call my own update function for the entire grid which sets the correct visibility of items for the current state, and then call PropertyStoreSynchronizeAll.
The problem is using PropertyStoreSynchronizeAll causes the problems mentioned previously. I was hoping that just changing the visibility of items instead of recreating the all properties everytime might be the way to go, but I still need to use PropertyStoreSynchronizeAll as far as I can tell.
I have some properties which affect the visibility of other items.
I also have some properties where the active and/or the default value needs to change - these might not require a call to PropertyStoreSynchronizeAll, though a possible complicating factor is that I might later be using Combination Stores.
|
|
Technical Support
|
Sep 12, 2007 - 12:49 PM
|
We do not support the PropertyStoreSynchronize() -like API for updating the property grid control partially because in most cases the tree structure of the property store is changed completely. The updated version of grid controls in the current source code 2.81 (including the tree grid windows used in the property grid control) support invisible rows and columns. So, we can assume your last message in this thread as a feature request.
|
|
Technical Support
|
Sep 10, 2007 - 1:21 PM
|
The property grid is designed as a container for one or more tree grid windows displaying the content of property store’s tree in different ways. The tree grids contain cloned copies of grid cells from the property values in property store’s tree. The CExtPropertyGridCtrl::PropertyStoreSynchronize() method re-creates the content of the tree grids completely because it assumes the tree structure of property store can be different. If your application changes only some property values then it should update only grid cells of these property values. Please provide us with more information about your task so we can find the best possible solution for you.
|
|
Richard Rodruck
|
Sep 7, 2007 - 7:24 AM
|
When I print a grid the font is very large. It is as though the DC is not changed form the screen to the printer DC.
|
|
Richard Rodruck
|
Sep 10, 2007 - 4:50 PM
|
Thanks, works like a charm.
|
|
Technical Support
|
Sep 10, 2007 - 2:11 PM
|
By default, in the grid windows the same font is used for the desktop painting, printing and print previewing. This font is returned by the gridās OnSiwGetDefaultFont() virtual method. We do not support custom fonts for desktop and printer for particular cells. So, we will discuss only the font replacement for the entire grid. To change the default printing and print preview font in your print-preview-able grid control, you should override the CExtPPVW_Printable::OnPrepareDC() virtual method: virtual void OnPrepareDC(
CDC * pDC,
CPrintInfo * pInfo = NULL
)
{
ASSERT_VALID( this );
ASSERT_VALID( pDC );
ASSERT( pDC->GetSafeHdc() != NULL );
pInfo; // unused parameter
CFont * pFont = . . . // your custom font
ASSERT( pFont->GetSafeHandle() != NULL );
pDC->SelectObject( pFont );
}
|
|
Adam Keadey
|
Sep 7, 2007 - 3:30 AM
|
I’m trying to use best row fit for images and it is not working. I assume I have not turned on a style or something. Code following:
bool bRedraw = false;
//m_pDataProvider = NULL; OuterRowCountTopSet( 1L, bRedraw ); OuterColumnCountLeftSet( 1L, bRedraw ); OuterColumnCountRightSet( 1L, bRedraw ); OuterColumnWidthSet( true, 0L, 14 ); OuterColumnWidthSet( false, 0L, 14 );
NoHideSelectionSet( true, bRedraw ); SubtractSelectionAreasSet( true, bRedraw ); LbExtSelectionSet( true ); GridLinesHorzSet( true, bRedraw ); GridLinesVertSet( true, bRedraw ); HoverEventsSet( true, true ); MultiAreaSelectionSet( true ); HoverHighlightSet( true, false, false, false, true, true );
BseModifyStyleEx(__EGBS_DYNAMIC_RESIZING|__EGBS_RESIZING_CELLS_INNER, __EGBS_FIXED_SIZE_ROWS);
//clear the grid ClearGrid();
//insert the columns ColumnAdd(2);
//add the data pHeaderData = STATIC_DOWNCAST( CExtGridCellHeader, GridCellGetOuterAtTop( 0, 0L, RUNTIME_CLASS(CExtGridCellHeader) ) ); pHeaderData->TextSet( "Data" ); pHeaderData->ExtentPercentSet(50); pHeaderData->ExtentSet(200);
//add the value pHeaderValue = STATIC_DOWNCAST( CExtGridCellHeader, GridCellGetOuterAtTop( 1, 0L, RUNTIME_CLASS(CExtGridCellHeader) ) ); pHeaderValue->TextSet( "Value" ); pHeaderValue->ExtentPercentSet(50); pHeaderValue->ExtentSet(200);
////insert the rows RowAdd(1);
CExtBitmap bitmap; bitmap.LoadBMP_File("res\\Acropolis.bmp", true); bitmap.AlphaColor(RGB(0,128,128), RGB(0,0,0), 0); CExtGridCellPicture * pCellDesc = STATIC_DOWNCAST( CExtGridCellPicture, GridCellGet( 0L, 0, 0, 0, RUNTIME_CLASS(CExtGridCellPicture) ) ); pCellDesc->BitmapSet(&bitmap); this->BestFitRow(0);
|
|
Technical Support
|
Sep 18, 2007 - 11:34 AM
|
|
|
Suhai Gyorgy
|
Sep 7, 2007 - 5:28 AM
|
I’ve met this problem not so long ago. It turned out that the problem is caused by the fact that each row has a maximum height set by default, and this max height is a regular single line. So the solution was that I had to call ExtentSet(200, 1); for each row header when initializing. The value 200 is just a made-up value, I guess it could work with any other big enough value.
|
|
Adam Keadey
|
Sep 7, 2007 - 5:38 AM
|
That did not work. I tried setting it on all rows and columns including the header
|
|
Suhai Gyorgy
|
Sep 7, 2007 - 6:14 AM
|
Ok, just to make sure I understood you: Did you try this code? pHeaderValue =
STATIC_DOWNCAST(
CExtGridCellHeader,
GridCellGetOuterAtLeft(
0,
0L,
RUNTIME_CLASS(CExtGridCellHeader)
)
);
pHeaderValue->ExtentSet(200, 1);
pHeaderValue =
STATIC_DOWNCAST(
CExtGridCellHeader,
GridCellGetOuterAtRight(
0,
0L,
RUNTIME_CLASS(CExtGridCellHeader)
)
);
pHeaderValue->ExtentSet(200, 1);
I think (not definitely sure though) that in your case your need to set both left and right header cells, as these cells store the extent of the row.
|
|
Adam Keadey
|
Sep 7, 2007 - 8:13 AM
|
To simplify I just set it to one column and still had the problem even making the call of pHeaderValue->ExtentSet(200, 1)
|
|
Suhai Gyorgy
|
Sep 7, 2007 - 12:55 PM
|
I made a sample app, only a dialog with one single grid on it. In its OnInitDialog I placed your code (just needed to add the grid variable for the grid-calls), together with my proposed addition. The bmp I used was 32x32 in size. The row height was adjusted properly. Please check your code to this one: // your code above, all the same till RowAdd call
////insert the rows
m_wndGrid.RowAdd(1);
pHeaderValue =
STATIC_DOWNCAST(
CExtGridCellHeader,
m_wndGrid.GridCellGetOuterAtLeft(
0,
0L,
RUNTIME_CLASS(CExtGridCellHeader)
)
);
pHeaderValue->ExtentSet(200, 1);
CExtBitmap bitmap;
bitmap.LoadBMP_File(_T("res\\tools.bmp"), true);
bitmap.AlphaColor(RGB(0,128,128), RGB(0,0,0), 0);
CExtGridCellPicture * pCellDesc =
STATIC_DOWNCAST(
CExtGridCellPicture,
m_wndGrid.GridCellGet(
0L,
0,
0,
0,
RUNTIME_CLASS(CExtGridCellPicture)
)
);
pCellDesc->BitmapSet(&bitmap);
m_wndGrid.BestFitRow(0);
|
|
Adam Keadey
|
Sep 18, 2007 - 9:28 AM
|
Can I post my code somewhere to have it looked at?
|
|
Debabrata Mukherjee
|
Sep 6, 2007 - 7:16 AM
|
Hi, We have a Dockable CExtToolControlbar in our application. We need to hide this from our application depending on some conditions. When the toolbar is present at the toolbar window with the other toolbars; we are able to hide it without any problem. But when the toolbar is in floating condition at the client area of the main application,only the button inside the toolbar is hidden and if at this point the toolbar is dragged towards the toolbar window it gives debug assertion error. Now our question is 1. Is it possible to hide the toolbar window rather than the button inside the toolbar? 2. Although the assertion error does not crash the application but what is the solution to remove that?
|
|
Technical Support
|
Sep 7, 2007 - 6:49 AM
|
There is a CFrameWnd::ShowControlBar() method that should be used for hiding and showing toolbars. So, you should never use CWnd::ShowWindow() nor CWnd::SetWindowPos() for changing the visibility of control bars. Of course, we expect you should have no assertion failures in this case. Please check this and if the problem persists, let us know.
|
|
Debabrata Mukherjee
|
Sep 6, 2007 - 12:06 AM
|
I have created a CExtTabWnd in my app. When I move the mouse over the scroll arrow at the end of the window, I get a debug assert. Is there any specific handling that I need to do.
|
|
Debabrata Mukherjee
|
Sep 12, 2007 - 1:57 PM
|
I think it could be a time consuming affai if we go for desktop sharing.
I hope you got the issue right. When ever a mouseover is done on the scroll arrow of the tab strip, a debug assert comes up. Can you tell us why?
Again is there any handler which i might have missed.
|
|
Technical Support
|
Sep 13, 2007 - 5:39 AM
|
We asked you for desktop sharing because the buttons inside tab window are too simple and we absolutely have no idea how they can raise any assertions. This desktop sharing should take a few minutes.
|
|
Debabrata Mukherjee
|
Sep 12, 2007 - 7:25 AM
|
Can you be more specific in your reply... I am unable to locate any such forum postings...
|
|
Technical Support
|
Sep 12, 2007 - 1:06 PM
|
Please let us know if it would be suitable for you if we just connect to your desktop and find out what’s wrong?
|
|
Debabrata Mukherjee
|
Sep 6, 2007 - 7:46 AM
|
PFB the call stack
/*******************************************************************************************************************************/
> mfc80d.dll!CWnd::AssertValid() Line 894 + 0x1b bytes C++ SaBins.ocx!CExtTabWnd::AssertValid() + 0x2b bytes mfc80d.dll!AfxAssertValidObject(const CObject * pOb=0x02ca87b8, const char * lpszFileName=0x09397cd0, int nLine=5849) Line 107 C++ SaBins.ocx!CExtPopupMenuTipWnd::Show() + 0x73 bytes SaBins.ocx!CExtTabWnd::OnAdvancedPopupMenuTipWndDisplay() + 0x8f bytes SaBins.ocx!CExtTabWnd::OnTabWndMouseTrackingHoverStart() + 0x58a bytes SaBins.ocx!CExtTabWnd::_ProcessMouseMove() + 0x429 bytes SaBins.ocx!CExtTabWnd::OnMouseMove() + 0x41 bytes mfc80d.dll!CWnd::OnWndMsg(unsigned int message=512, unsigned int wParam=0, long lParam=786623, long * pResult=0x0012f8b0) Line 2169 C++ mfc80d.dll!CWnd::WindowProc(unsigned int message=512, unsigned int wParam=0, long lParam=786623) Line 1741 + 0x20 bytes C++ SaBins.ocx!CExtTabWnd::WindowProc() + 0xb6 bytes mfc80d.dll!AfxCallWndProc(CWnd * pWnd=0x02ca87b8, HWND__ * hWnd=0x00180efe, unsigned int nMsg=512, unsigned int wParam=0, long lParam=786623) Line 240 + 0x1c bytes C++ mfc80d.dll!AfxWndProc(HWND__ * hWnd=0x00180efe, unsigned int nMsg=512, unsigned int wParam=0, long lParam=786623) Line 389 C++ SaBins.ocx!AfxWndProcDllStatic(HWND__ * hWnd=0x00180efe, unsigned int nMsg=512, unsigned int wParam=0, long lParam=786623) Line 73 + 0x15 bytes C++ user32.dll!7e418734() [Frames below may be incorrect and/or missing, no symbols loaded for user32.dll] user32.dll!7e418816() user32.dll!7e41f805() user32.dll!7e4189cd() user32.dll!7e431b3c() user32.dll!7e418a10() user32.dll!7e42d99d() user32.dll!7e43c69b() mfc80d.dll!COccManager::IsDialogMessageA(CWnd * pWndDlg=0x02c5e780, tagMSG * lpMsg=0x01015374) Line 805 + 0x11 bytes C++ mfc80d.dll!CWnd::IsDialogMessageA(tagMSG * lpMsg=0x01015374) Line 195 + 0x20 bytes C++ mfc80d.dll!CWnd::PreTranslateInput(tagMSG * lpMsg=0x01015374) Line 4268 C++ SaISD.exe!CExtControlBar::PreTranslateMessage(tagMSG * pMsg=0x01015374) Line 18584 C++ mfc80d.dll!CWnd::WalkPreTranslateTree(HWND__ * hWndStop=0x00160f16, tagMSG * pMsg=0x01015374) Line 2882 + 0x14 bytes C++ mfc80d.dll!AfxInternalPreTranslateMessage(tagMSG * pMsg=0x01015374) Line 233 + 0x12 bytes C++ mfc80d.dll!CWinThread::PreTranslateMessage(tagMSG * pMsg=0x01015374) Line 773 + 0x9 bytes C++ SaISD.exe!CSaIsApp::PreTranslateMessage(tagMSG * pMsg=0x01015374) Line 538 C++ SaISD.exe!CVbfxApp::PumpMessage() Line 478 + 0x25 bytes C++ SaISD.exe!CVbfxApp::MessageLoop(int bPushedByHost=1) Line 569 + 0x8 bytes C++ SaISD.exe!CVbfxApp::Run() Line 527 C++ mfc80d.dll!AfxWinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, char * lpCmdLine=0x00152327, int nCmdShow=1) Line 47 + 0xd bytes C++ SaISD.exe!WinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, char * lpCmdLine=0x00152327, int nCmdShow=1) Line 29 C++ SaISD.exe!__tmainCRTStartup() Line 578 + 0x35 bytes C SaISD.exe!WinMainCRTStartup() Line 403 C kernel32.dll!7c816fd7() /****************************************************************************************************************************************/
Even I have not used any handling for this,But some how it seems to be getting this assertion error when mouse is being hovered. Can you give me some pointers...
Thanks
|
|
Technical Support
|
Sep 7, 2007 - 6:52 AM
|
We believe the problem may deal with managing the state in an incorrect way and it should be gone by applying the correct RDE version to your regular DLLs. If more than one regular DLL uses Prof-UIS, you should link them with Prof-UIS statically. Otherwise, the state managing will not be performed correctly in any hook based components. This means you would not be able to use only simple non-hook based controls.
This problem was already discussed many times, so you can find information about how to use this yourself by running the forum search.
|
|
Technical Support
|
Sep 6, 2007 - 5:32 AM
|
The mouse hover event over scroll/help/tab-list/close buttons in the tab window only repaint them in the hovered style. You should not try handling this event. Could you show the content of the Call Stack window content in Visual Studio when the assertion failure occurs?
|
|
Suhai Gyorgy
|
Sep 6, 2007 - 1:36 AM
|
When you have a problem where there is a debug assertion involved, it is always very helpful to post the call stack as it is at the time of the assert. It’s a starting point to find out what causes the problem.
There shouldn’t be any specific handling you need to do in your case. But let’s see the call stack.
|
|
Massimo Germi
|
Sep 5, 2007 - 9:28 AM
|
Hi to all, Is need to hide some column when I switch CExtTreeGridWnd derived class, in print preview mode.
My application display some records of a database. I use uniqueidentifier type in SQL2005 to identify single record of a table. When I display a record in a treegrid I set width = 0 of a column that comtains a UUID reference. When a user switch to print preview prints UUID column too.
Is very very important for me to have this possibility. Please give me a solution
Thanks in advance
|
|
Technical Support
|
Sep 5, 2007 - 12:55 PM
|
The printing and print preview subsystem, which is based on the CExtPPVW template class, measures and prints the entire content of the grid window. In some cases this is not acceptable. We received a similar request: one of our customers uses a zero-width outer header column for keeping additional per-row data in outer header cells and this header column is also printed/measured when it should not. We are working on the improvement of the printing and print preview subsystem now. So, it will be possible to hide any column.
|
|
tera t
|
Sep 5, 2007 - 2:44 AM
|
Hello
I want to display character string in the top and bottom center. CExtEdit does not seem to have those functions.
|
|
Technical Support
|
Sep 5, 2007 - 12:44 PM
|
The CExtEdit class does not implement any editing behavior. It is a re-painted version of the MFC’s CEdit class with borders. We follow an absolutely different approach in such cases. We create an edit control whose size is exactly determined by the height of the edited text and place the editor into the apporpriate location.
|
|
tera t
|
Sep 5, 2007 - 6:12 PM
|
Hello.
It wants to easily come true. Will not there be a good part?
|
|
Technical Support
|
Sep 6, 2007 - 7:10 AM
|
Actually it is not so easily to implement as it sounds. We believe that such a feature is less important than other features in our TO-Do list, so we cannot promise you that it will be implemented soon.
|
|
tera t
|
Sep 6, 2007 - 10:25 PM
|
Hello~
CRect rect, rect2; GetClientRect(rect); rect2 = rect; rect2.top = (rect.bottom - nFontHeight) / 2; rect2.bottom = rect2.top + nFontHeight; SetRect(rect2);
|
|
tera t
|
Sep 4, 2007 - 11:27 PM
|
Hello.
I want to change a position of the cell which did a selection of plural ranges I do a selection of plural ranges. From the inside done a selection of, I want to change a cell focus and a cell position.
Thanks,
|
|
Technical Support
|
Sep 5, 2007 - 12:48 PM
|
Unfortunately it is not completely clear what you want to achieve. The CExtGridCell::OnGbwAdjustRects() virtual method allows you to change the cell location inside the grid control. It can be used for implementing such visual effects like cell joining demonstrated in the following sample:
JoinedCells.zip
|
|
tera t
|
Sep 5, 2007 - 6:28 PM
|
Hello.
ttp://profuis0.tripod.com/20070906/image01.jpg
In domains done a selection of, I want to change a position of a focus and a selection of a selection Is not it made?
|
|
Technical Support
|
Sep 6, 2007 - 5:30 AM
|
Your screenshot displays a range of selected cells. We guess you made the selection in this way:
1) You selected the top left cell ("Peacock, Margaret").
2) You selected the bottom right cell ("1996/07/15") text by mouse click with the Shift key pressed or using arrow keys with the Shift key pressed.
As a result, the bottom and right cell becomes both selected and focused. The selection range is described by two cell coordinates first (top/left) and second(bottom/right). The focus in such case is automatically moved to the second cell both in our grid and in all known other grids. If you need focus on top/left cell, you should invert the sequence of selection actions. You should select the bottom right cell first and the top left cell second. If you want to change the grid behavior and make it keeping the selection on first cell, you should remove the __EGBS_AUTO_FOCUS_BOTTOM_RIGHT style from the grid window using its SiwModifyStyle() method.
|
|
tera t
|
Sep 6, 2007 - 10:27 PM
|
I try to test it in this a little. Thanks,
|
|
Chris Anderson
|
Sep 4, 2007 - 7:12 PM
|
I tried to create transparent controls on a background window. With 2007 themes, the background window is gradient but the controls ( CExtLabel, CExtCheckBox, CExtRadioButton ) are not, which doesn’t look good.
I managed to make the label work, but still have problem with the check box and radio button. What I did is :
1. create a CWnd based window, and paint its client rect with g_PaintManager->PaintDocumentClientAreaBkgnd
( for some reason we decided not to use prof-uis class for the background window )
2. create a new checkbox ( CExtCheckBox )
When I debugged into the code ( Prof-UIS v281 ) with 2007 luna blue theme, it looks that CExtButton::DrawItem() ends up calling CExtPaintManagerOffice2003::PaintDockerBkgnd() to paint the background rect of the check box, even though it’s a 2007 theme. See the code snippet below :
COLORREF clrLeft = GetColor( _2003CLR_GRADIENT_DARK, NULL ); COLORREF clrRight = GetColor( _2003CLR_GRADIENT_LIGHT, NULL ); if( clrLeft == clrRight ) { dc.FillSolidRect( &rcDst, clrLeft ); __EXT_PROFUIS_PAINT_EVALUATION_LOGO( dc, &rcDst, bClientMapping, NULL ); return true; }
clrLeft and clrRight are equal, therefore it simply call FillSolidRect() and return. This would make the check box rect non-transparent ?
The call stack looks like :
> CExtPaintManagerOffice2003::PaintDockerBkgnd( ) Line 22557 CExtPaintManagerOffice2007_Impl::PaintDockerBkgnd() Line 45712 CExtPaintManagerOffice2003::PaintDockerBkgnd() Line 22534 CExtCheckBox::_RenderImpl()
For me painting the bkgd area is really not necessary, what I need is simply make this transparent. Is there any way to do this ?
Thanks
|
|
Technical Support
|
Sep 5, 2007 - 12:13 PM
|
The themed background is based on algorithms implemented in the paint manager. When you see a check box button with a background that is consistent with that of the parent dialog, this consistent background is provided by some calculations and painting invocations in the paint manager. Please note the dialog is not responsible for painting the background of its children controls. This is the default design and it was implemented due to optimization issues because querying chains of parent windows for painting the background of child controls can be quite slow especially if you have too much windows created at a time. In simple words, Prof-UIS provides a consistent background by default but it is not inherited between child/parent windows.
Now time for good news. There is another option. Prof-UIS supports inherited background painting, but this feature is turned off by default. You can see two configurable types of the inherited background in the TabbedBars sample: the consistent gradient background of tab page dialogs in a One Note tab page container window created instead of the main SDI view and a hurricane-like background in the main frame window. To enable the inherited background, you should invoke the following code both at startup and when you changes the current paint manager: pPM->m_bCustomBackgroundInheritanceEnabled = true; After that each Prof-UIS control sends the CExtPaintManager::g_nMsgPaintInheritedBackground registered message to their parent windows until one of the parent windows in the chain paints a custom background for the control. The CMainFrame::OnMsgPaintInheritedBackground() and CChildView::OnMsgPaintInheritedBackground() methods in the TabbedBars sample demonstrate how to handle the CExtPaintManager::g_nMsgPaintInheritedBackground registered message. So, your message handler should paint control backgrounds using the g_PaintManager->PaintDocumentClientAreaBkgnd(...) code instead of gradients and hurricanes painted in our sample application. The CExtPaintManager::g_nMsgPaintInheritedBackground registered message can be send for painting of both client and non client window areas. You should get a completely consistent inherited background.
|
|
David Skok
|
Sep 4, 2007 - 12:13 PM
|
I am using a PropertyGrid in my app and do not wish to display a ComboBox or Toolbar and so followed your FAQ regarding not displaying them. I chose to override OnPgcCreateBars() and not create either of these controls. This method does NOT work. It throws an unhandled exception in a call to AfxIsValidAddress inside CExtControlBar::DoCustomModeUpdateControlBars in this line:
hWndUpdateTarget = pWndParentTarget->GetSafeHwnd();.
Just an FYI, I don’t have time to create a small sample proving it.
I’m hiding these windows to do what I want.
|
|
Technical Support
|
Sep 4, 2007 - 1:07 PM
|
We need to reproduce the problem in some way. That is why we asked you to prepare and send a test project. Actually you could also modify our CompoundProperties sample . We added the following method to declaration of the CCanvasPropertyGridCtrl class in this sample: bool OnPgcCreateBars()
{
ASSERT_VALID( this );
try
{
// CExtPropertyGridComboBoxBar * pComboBoxBar =
// new CExtPropertyGridComboBoxBar( this );
// pComboBoxBar->m_bAutoDeleteWindow = true;
// if( ! pComboBoxBar->Create(
// this,
// true
// )
// )
// {
// ASSERT( FALSE );
// throw __EXT_MFC_ID_PROPERTY_GRID_COMBO_BOX;
// }
CExtPropertyGridToolBar * pToolBar =
new CExtPropertyGridToolBar( this );
pToolBar->m_bAutoDeleteWindow = true;
if( ! pToolBar->Create(
this,
true
)
)
{
ASSERT( FALSE );
throw __EXT_MFC_ID_PROPERTY_GRID_TOOLBAR;
}
CExtPropertyGridTipBar * pTipBar =
new CExtPropertyGridTipBar( this );
pTipBar->m_bAutoDeleteWindow = true;
if( ! pTipBar->Create(
this,
true
)
)
{
ASSERT( FALSE );
throw __EXT_MFC_ID_PROPERTY_GRID_TIPBAR;
}
}
catch( ... )
{
return false;
}
return true;
} So please try it. This is enough to kill the combo box inside the property grid control but not enough to make the CompoundProperties working. So, we also commented out the following lines in the CMainDlg::OnInitDialog() method: // CExtPropertyGridComboBoxBar * pCombo =
// STATIC_DOWNCAST(
// CExtPropertyGridComboBoxBar,
// m_PGC.GetChildByRTC(
// RUNTIME_CLASS(CExtPropertyGridComboBoxBar)
// )
// );
// ASSERT_VALID( pCombo );
// m_PGC.m_PS.Combine( &(m_PGC.m_OC.m_obj1.GetPropertyStore()) );
// m_PGC.m_PS.Combine( &(m_PGC.m_OC.m_obj2.GetPropertyStore()) );
// m_PGC.m_PS.Combine( &(m_PGC.m_OC.m_obj3.GetPropertyStore()) );
And we commented the following lines in the same method:
// pCombo->PropertyStoreInsert( &m_PGC.m_PS );
// pCombo->PropertyStoreInsert( &(m_PGC.m_OC.m_obj1.GetPropertyStore()) );
// pCombo->PropertyStoreInsert( &(m_PGC.m_OC.m_obj2.GetPropertyStore()) );
// pCombo->PropertyStoreInsert( &(m_PGC.m_OC.m_obj3.GetPropertyStore()) );
// pCombo->SetCurSel( 1 );
// m_PGC.PropertyStoreSet( &(m_PGC.m_OC.m_obj1.GetPropertyStore()) ); Now you can run the sample application and see the property grid control without the combo box. What we did is: 1) We removed the combo box bar from the property grid control. 2) We removed some references to this combo box bar from the source code of our sample application.
|
|
David Skok
|
Sep 5, 2007 - 9:14 AM
|
I made the mods to the sample and it works however I see a fundamental difference between it and my own code. In the sample, PropertyStores are created in the buttons and persist as long as the app does. In my app I dynamically create stores and I delete them when a new property store is created. I call SetPropertyStore(0) then delete the store. I called SetPropertyStore(0) in the destructor of the PropertyGrid, this was the source of the problem.
|
|
Francesco Toscano
|
Sep 4, 2007 - 11:32 AM
|
I do not know if it is possible, I think that should be. I would like to change the cell type for the outer right column, in my case, I would like to use a Check Box type cell instead of the default one. But at the moment I have not found any solution. I am working on a cacheble database grid. If what I am asking it is possible, Could you please give me an example on how I can do it? If yes, because I am using a cacheble database grid (derived from CExtGridWnd), where is the right place to do this cell type change?
Many thanks Francesco Toscano.
|
|
Francesco Toscano
|
Sep 5, 2007 - 9:15 AM
|
First of all thanks for your fast reply then thanks for the detailed explanation. Now it is the much clearer way in which these classes works.
But now I have another question: Since I would want to change, in the way you suggested, the Cells that are OuterAtRight of af cacheble DatabaseGrid grid.
Because a cacheable grid constantly updates cached cell range during scrolling, where is the best place to instantiate this check box class? Actually I fill the data cells and header in the my derived "CExtGridDataProvider" (as you do in your sample). Because I do not need to fill these cells with data or other ( I just want a selectable check box for every row in grid), It can be done just one time during initialization?
Your suggestions are welcome!
Francesco Toscano
|
|
Technical Support
|
Sep 5, 2007 - 12:34 PM
|
We suppose you created a CExtGridDataProviderRecordset -derived class that implements your cacheable grid and overrode the CExtGridDataProviderRecordset::RsCacheRow() virtual method in it. Both the data and outer header cells should be initialized in this method for each row. Let us suppose you have 2 header columns on the left (L0 and L1), 5 data rows (D0, D1, D2, D3 and D4) and 3 header columns on the right (R0, R1 and R2). In this case, each visible row in your grid should look like as follows: L0 L1 D0 D1 D2 D3 D4 R0 R1 R2 The data provider keeps an array of grid cells for each row in the following order: L0 L1 R0 R1 R2 D0 D1 D2 D3 D4 So, your version of the RsCacheRow() virtual method should initialize row cells in the same order.
|
|
Technical Support
|
Sep 5, 2007 - 5:51 AM
|
Most of the features of all grid cells are implemented in the basic CExtGridCell class, including built-in support for a check box, an image, text, a drop-down button, an up-down button and an ellipsis button. The CExtGridCellCheckBox class just provides a simpler API for working with a check box cell. The CExtGridCellComboBox class provides an API similar to that in the combo box control and it manages a collection of strings. Some other classes provide alternative data for editing and alternative in-place editor windows instead of a simple single line edit control provided by the CExtGridCell class. You can use any cell class in outer header areas. The only difference between outer header cells and data cells is that they optionally should store column minimal/maximal/current widths (current width values in pixels and/or double values for proportional column resizing) and row minimal/maximal/current heights (current height values in pixels and/or double values for proportional row resizing) when your grid window uses variable/resizable columns and/or rows. The CExtGridCellHeader class implements a grid cell which is a simple string cell class with the ability to store row height or column width values called extents. To make any grid cell able to store extents in pixels, you should apply the CExtGCE template decorator class to it. To make any grid cell able to store proportional extents, you should apply the CExtGCP template decorator class to it. There are several other template decorator classes for extending capabilities of grid cells, but they are not related to your question. For example, the CExtGridCellHeader class is declared as follows: class CExtGridCellHeader
: public CExtGCF < CExtGCC < CExtGCP < CExtGCE < CExtGridCellStringDM > > > >
{
. . . As you can see, both the CExtGCE and CExtGCP template classes are present in it. You can create the same class based on the check box cell and use it in header areas: class CYourCheckBoxCellForOuterHeaderArea : public CExtGCP < CExtGCE < CExtGridCellCheckBox > >
{
public:
DECLARE_SERIAL( CYourCheckBoxCellForOuterHeaderArea );
IMPLEMENT_ExtGridCell_Clone( CYourCheckBoxCellForOuterHeaderArea, CExtGCP < CExtGCE < CExtGridCellCheckBox > > );
CYourCheckBoxCellForOuterHeaderArea( CExtGridDataProvider * pDataProvider = NULL )
: public CExtGridCellCheckBox( pDataProvider )
{
}
CYourCheckBoxCellForOuterHeaderArea( const CExtGridCell & other )
: public CExtGridCellCheckBox( other )
{
}
virtual ~CYourCheckBoxCellForOuterHeaderArea()
{
}
};
// The following line of code should be placed at the beginning of .CPP file before definition
// of the MFC debug version of the new operator:
IMPLEMENT_SERIAL( CYourCheckBoxCellForOuterHeaderArea, CExtGridCellCheckBox, VERSIONABLE_SCHEMA|1 ); To instantiate this check box class in the header areas of the CExtGridWnd control you should simply use it in the invocation of the CExtGridWnd::GridCellGet***() methods: CExtGridWnd * pGrid = . . .
CExtGridCell * pCell = pGrid->GridCellGetOuterAtTop( nColNo, nRowNo, RUNTIME_CLASS( CYourCheckBoxCellForOuterHeaderArea ) );
if( pCell != NULL )
{
CYourCheckBoxCellForOuterHeaderArea * pYourCell =
STATIC_DOWNCAST( CYourCheckBoxCellForOuterHeaderArea, pCell );
. . .
}
|
|
Suhai Gyorgy
|
Sep 4, 2007 - 8:29 AM
|
Dear Support,
On our CExtResizableDialog we need to show a 32-bit bitmap, but it has a ragged edge (around each side of it some pixels are more or less transparent). I tried to use your CExtLabel, using SS_BITMAP style and SetBitmap method. The problem is that the same color is used where the pixels are transparent. I see in your CExtLabel source that the gradient background is not drawn when the SS_BITMAP style is used, in this case you just call Default().
I’ve solved the problem by deriving a class from CExtLabel. In this class I have a CExtBitmap and I load my bitmap in it. I overriden OnPaint, call CExtLabel::DoPaint in it and then AlphaBlend on the CExtBitmap. But I don’t really like this solution, having to do all the painting in my code.
Is there any other solution you could suggest? Thank you very much! Chris
|
|
Technical Support
|
Sep 4, 2007 - 12:59 PM
|
We could implement the same code in the CExtLabel class, but it would not draw 32-bit bitmaps with alpha channel correctly on all the Windows OS versions. Old Windows OS versions do not load such bitmaps correctly. The universal solution is to create a new CExtLabel -derived class and specify a CExtBitmap property in it. This CExtBitmap object should be loaded through the CExtBitmap APIs only. This will be approximately the same as you did.
|
|
Suhai Gyorgy
|
Sep 5, 2007 - 1:34 AM
|
Could you please provide this mentioned CExtLabel-derived class? I’d like to check if there’s any code in it which would improve my version. The bitmap is loaded from resource.
Thank you again for your continuous help!
|
|
Technical Support
|
Sep 5, 2007 - 9:42 AM
|
We have just added the functionality you requested. Please download the updated code from our ftp server. The CExtLabel class now supports a custom bitmap. The bitmap can be aligned, tiled, or stretched using the
CExtLabel::SetImageMode() method. The bitmap is based on CExtBitmap so you can use 32-bit bitmaps with alpha channel.Here are the methods that were added to CExtLabel : GetBitmapEx()
SetBitmapEx()
GetImageMode()
SetImageMode()
|
|
tera t
|
Sep 4, 2007 - 3:13 AM
|
Hello.
Because I want to acquire cell width. I become a const error when I make the following sauce.
void CMuGrid::OnGbwAdjustRects( LONG nColNo, LONG nRowNo, INT nColType, INT nRowType, RECT & rcCellExtraA, RECT & rcCellA ) const { CExtGridWnd::OnGbwAdjustRects( nColNo, nRowNo, nColType, nRowType, rcCellExtraA, rcCellA );
int ix; ix = rcCellA.top;
if ( m_DwCopyFlag == true && nColType == 0 && nRowType == 0 ){ if ( m_CpRect.left == nColNo && m_CpRect.top == nRowNo ){ m_CpRectDraw.top = rcCellA.top; m_CpRectDraw.left = rcCellA.left; } if ( m_CpRect.right == nColNo && m_CpRect.bottom == nRowNo ){ m_CpRectDraw.bottom = rcCellA.bottom; m_CpRectDraw.right = rcCellA.right; } } }
Will not there be a good method?
|
|
Technical Support
|
Sep 4, 2007 - 10:29 AM
|
You can retrieve the coordinates of a cell (in the grid control’s client coordinate system) using the CExtGridWnd::GridCellRectsGet() method. This method allows you to get the entire cell rectangle and/or rectangles of cell parts. CExtGridWnd & wndGrid = . . .
LONG nColNo = . . .
LONG nRowNo = . . .
CRect rcCellLocation;
if( ! wndGrid.GridCellRectsGet(
nColNo,
nRowNo,
0,
0,
NULL,
&rcCellLocation
)
)
return . . . It returns true if the rcCellLocation rectangle was filled with correct cell rectangle coordinates and false if it is not possible to compute cell coordinates (the cell at column nColNo and row nRowNo is outside the visible cell range or method parameters are invalid). You can also use the CExtGridCell::MeasureCell() method which measures the cell and returns its size in pixels.
|
|
tera t
|
Sep 4, 2007 - 8:57 PM
|
|
|
Francesco Toscano
|
Sep 3, 2007 - 9:37 AM
|
I have a Grid that uses a database source to fill the cells contet, I would like to use "CExtGridWnd::BestFitColumn" in order to fit the cell width according their content. Because The grid it is updated at every changes of the scrollbars, where is the right place to do use it, within the grids events?
I have tryed the follow:
bool CGridWnd::OnSiwCacheChanged( const CExtScrollItemCacheInfo & _sciNew, const CExtScrollItemCacheInfo & _sciOld ) { bool result = CExtGridWnd::OnSiwCacheChanged(_sciNew,_sciOld);
LONG cols = ColumnCountGet();
for(LONG col = 0; col < cols; col++) BestFitColumn(col, 0);
return result; }
in my derived grid window class, but it takes vary long times to be completed with large amount of data. What can I do?
Thanks in advance
Francesco Toscano
|
|
Technical Support
|
Sep 3, 2007 - 11:38 AM
|
It is not a good idea to best fit a column with in virtually cacheable grids. In a memory grid you can do best fit by entire rows in a column or by visible rows only. But entire range cells are not available in a virtually cacheable grid. So, you can do best fit by visible rows only. Since a cacheable grid constantly updates cached cell range during scrolling, the content width of the visible cells in ca olumn can be constantly changing. We are not sure best fit is a good idea in these cases. You only have a reason to enable best fit by visible cells in column on header divider double click.
|