|
I am a VB programmer and can understand C#, but this is written in C, which I don't have on my pc and can't understand it at all. Anyone have a VB or C# example of this?
I just want to know how to do a multiline text in a property grid.
|
|
|
|
|
Hello,
I think this is very nice control and works very nice as a control in Dialog Box.
But now I like to use this control as a child control of normal window(view).
How can I create this control window without using DDX_Control?
I look at the source code and couldn't find a way.
Could you let me know how to use it as a child window?
Thanks,
Sang
|
|
|
|
|
I placed it in a window using CPropertyGrid::CreateEx but you can probably use CPropertyGrid::Create as well...
|
|
|
|
|
Thank you for your comment.
I used the below line to create it and it looks it's working fine now.
Thank you again for your great article.
Sang
RECT rc;
GetClientRect(&rc);
m_ctrlGrid.CreateEx(0, AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW), L"", WS_CHILD|WS_VISIBLE, rc, this, 0x1002);
|
|
|
|
|
Hello,
i try to add some string items, with this tabstop \t characters,
but they are not showed properly!
Any idea how to show special characters in new string items??
thanks for any help!
termal
|
|
|
|
|
Hello,
can i get a pointer to combo item, if yes how, any idea for this?
I like to call the CComboBox function:
SetCurSel(int iIndex);
thanks for any help!
termal
|
|
|
|
|
Hello,
how can i determine witch combo box is clicked if i have more then one??
There is a function:
LRESULT CPropertyGrid::OnComboSelChanged(WPARAM wParam, LPARAM lParam)
but this is for all comboboxes, no matter how many are in the propertygrid,
and i have two in grid, and if i select some text how to know witch combo is clicked??
Thanks for any help!!
termal
|
|
|
|
|
Hello,
from what I recall, wParam should be the HITEM of the combo box...
Regards,
|
|
|
|
|
Hello,
yes you have right, i solved already!
regards
termal
|
|
|
|
|
Hello,
i try to implement this grid in my project, but i have some problems!
I can bring my application to run, but when my dialog is visible and the grid,
i cant collapse the items, what im doing wrong!
Here is code snippet:
HSECTION hs = m_ctrlGrid.AddSection(_T("Basic Items"));
m_ctrlGrid.AddStringItem(hs, _T("String"), _T("A single line string item"));
m_ctrlGrid.AddTextItem(hs, _T("Text"), _T("A multi line text item.\r\nSecond line..."));
m_ctrlGrid.AddStringItem(hs, _T("Disabled item"), _T("A disabled item"), false);
m_ctrlGrid.AddIntegerItem(hs, _T("Integer"), 10);
m_ctrlGrid.AddIntegerItem(hs, _T("Formatted Integer"), 8, _T("%d inches"));
m_ctrlGrid.AddDoubleItem(hs, _T("Double"), 7.33);
m_ctrlGrid.AddDoubleItem(hs, _T("Formatted Double"), 10.25, _T("%gmm"));
m_ctrlGrid.AddBoolItem(hs, _T("Boolean"), true);
All items are showed, and [-] for collapse too, but it dont take effect when i'm click on the symbol!
Do i have to implement a function for collapse??
[EDIT]
What files need to implement to bring this grid to work!?
[/EIDT]
thanks for any help
termal
modified on Friday, November 21, 2008 7:28 AM
|
|
|
|
|
Hi,
does anyone have idea for my problem??
regards
termal
|
|
|
|
|
Hi,
i solved my problem, i forgot to activate Notify in the properties settings
regards
termal
|
|
|
|
|
I guess. can you check notify option of picture box control.
Hellow
|
|
|
|
|
I have changed the Unicode version to show the combobox list elements only when clicking on the down arrow box. If you need this change here is the code
file PropertyGrid.cpp starting with line 1608. Method CPropertyGrid::OnLButtonUp()
The added code is bolded italic:
else
{
if (m_rect_button.PtInRect(point))
{
// the combo rect
CRect rc = m_rect_button;
rc.left = m_gutter_width;
rc.top += m_line_height;
rc.bottom = rc.top + 100;
// create it
m_control = new CPropertyGridCombo();
CPropertyGridCombo* pCombo = (CPropertyGridCombo*)m_control;
pCombo->Create(WS_CHILD, rc, this, 0);
pCombo->SetColors(m_clrBack, m_clrText, m_clrFocus, m_clrHilite);
pCombo->SetFont(&m_fntNormal);
if (pItem->m_type == IT_BOOLEAN)
{
pCombo->AddString(m_strTrue);
pCombo->AddString(m_strFalse);
if (!pItem->m_undefined)
pCombo->SetCurSel(pItem->m_bValue?0:1);
}
else
{
for (vector<wstring>::iterator it = pItem->m_options.begin(); it != pItem->m_options.end(); ++it)
pCombo->AddString(*it);
if (!pItem->m_undefined)
pCombo->SetCurSel(pItem->m_nValue);
}
pCombo->ShowWindow(SW_SHOW);
}
}
}
|
|
|
|
|
Good Work!!!
but the "Ccustom Dropdown Edit" also has the problem~
|
|
|
|
|
The item-changed message (WM_PG_ITEMCHANGED ) is not sent when a EM_DROPDOWN Custom Item's value changes. To facilitate this, I added a new FlagItemChanged method to CPropertyGrid . In the implementation of the Custom Item, when the value has changed, instead of calling CPropertyGrid 's Invalidate , call this new method. The implementation of this method is as follows:
void CPropertyGrid::FlagItemChanged()
{
CItem* pItem = FindItem( m_focused_item );
GetOwner()->SendMessage(WM_PG_ITEMCHANGED, pItem->m_id);
Invalidate();
} Maybe a different approach could be used, but this is the approach I am currently using.
modified on Thursday, July 31, 2008 10:55 AM
|
|
|
|
|
hi, I love the control thanks for writing it, but I am curious if I am just missing something here or not. I am dealing with data that forces the bottom droplist off the screen and once it runs off there is no way for the user to access that data. Is there support for Scollbars in the combo box?
thanks
-eric
|
|
|
|
|
Just bumped into this problem myself. I am thus also looking for a solution.
|
|
|
|
|
For now I am avoiding this issue by using a custom control.
|
|
|
|
|
Even I need a Vertical scrollbar in the ComboBox Cell Control.
Also, is there any means by which I can change the ComboBox style to DropDown instead of DropList as I want the user to be able to add items to the ComBoBox Cell Control.
Tried modifying the Create() function of PropertyGridCombo.cpp but it didnt work..
Thanks in advance....
|
|
|
|
|
The dialog box for the font control (AddFontItem ) provides a selection for color. However, the color information is not communicated out of the PropertyGrid control in any manner. I can see in PropertyGrid.cpp CPropertyGrid::EditFocusedItem where a CFontDialog is constructed and used. A LOGFONT is copied out of the dialogs m_lf member, but the m_cf member is ignored.
For now I am going to remove the CF_EFFECTS flag from the dialog construction. This will remove the color selector from the dialog box, but also removes the Strikeout and Underline.
|
|
|
|
|
When using the after parameter of any of the CPropertyGrid::AddXXXItem methods, it appears to be completely ignored. The after parameter of the CPropertyGrid::AddSection does appear to work. Following the model of AddSection , I made the following change to AddItem(HSECTION hs, EItemType type, string name, void* pValue, bool editable, bool undefined, HITEM after) :
--- ../PropertyGrid/PropertyGrid.cpp (revision 22)
+++ ../PropertyGrid/PropertyGrid.cpp (working copy)
@@ -373,7 +373,12 @@
item.ValidateChanges();
- it->m_items.push_back(item);
+
+
+
+ vector<citem>::iterator itemIt = find( it->m_items.begin(), it->m_items.end(), after);
+ it->m_items.insert(itemIt, item);
+</citem>
RecalcLayout();
return item.m_id;
}
Thus the resulting function now reads:
HITEM CPropertyGrid::AddItem(HSECTION hs, EItemType type, string name, void* pValue, bool editable, bool undefined, HITEM after)
{
vector<csection>::iterator it = find(m_sections.begin(), m_sections.end(), hs);
if (it == m_sections.end())
return -1;
vector<citem>::iterator it2 = find(it->m_items.begin(), it->m_items.end(), name);
if (it2 != it->m_items.end())
return -1;
CItem item;
item.m_id = m_item_id++;
item.m_type = type;
item.m_name = name;
item.m_editable = editable;
item.m_undefined = undefined;
if (type == IT_CUSTOM) item.m_pCustom = (ICustomItem*)pValue;
else if (type == IT_STRING || type == IT_TEXT || type == IT_FILE || type == IT_FOLDER) item.m_strValue = *(string*)pValue;
else if (type == IT_COMBO || type == IT_INTEGER) item.m_nValue = *(int*)pValue;
else if (type == IT_DOUBLE) item.m_dValue = *(double*)pValue;
else if (type == IT_BOOLEAN) item.m_bValue = *(bool*)pValue;
else if (type == IT_DATE || type == IT_DATETIME) item.m_dtValue = *(COleDateTime*)pValue;
else if (type == IT_COLOR) item.m_clrValue = *(COLORREF*)pValue;
else if (type == IT_FONT) memcpy(&item.m_lfValue, pValue, sizeof(LOGFONT));
else assert(false);
item.ValidateChanges();
vector<citem>::iterator itemIt = find( it->m_items.begin(), it->m_items.end(), after);
it->m_items.insert(itemIt, item);
</citem>
RecalcLayout();
return item.m_id;
}
</citem></csection>
|
|
|
|
|
vector::iterator itemIt = find( it->m_items.begin(), it->m_items.end(), after);
it->m_items.insert(itemIt, item);
how to replace this two lines in the version of vc 6.0?
|
|
|
|
|
Almost a year after I made the post. Took me a moment to remember.
I do not see anything in what I did that would not work under VC6. That code was modeled after code that is in AddSection, therefore I would assume if what I did in AddItem does not work in VC6, it would not work in AddSection either.
However a note, a year ago I was using this code in VC6. However I was not using the the STL that came with VC6. Instead I was using STLport. (Specifically version 4.6.2. What I wasn't using a version 5.X I do not know.) Therefore the issue you are having may be related to this. In general the STLport that came with VC6 was terrible (personal opinion); many bugs, several missing features. STLport is a considerable improvement over the VC6 STL.
|
|
|
|
|
The license of this code is unclear. What is the license of this code?
The article says:
License
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
There is no license file in the source collection. Search for 'license' in all the files of the source collection finds nothing. Searching for 'copyright' in the files of the source collection finds a few things from different authors.
Therefore, I am free to use compiled in any application without encumbrance.
Therefore, I am free to use provided I give extra copyright notices (i.e. Berkeley style license).
Copyrighted, but no release. Thus technically one must assume one must get permission from the author, "nabocorp", to use this code in ANY form.
The rest of the code contains no copyright notice, thus one must assume it is copyrighted, presumably by the author of the article, "Nicolas Bonamy". However, again, with no release one must assume one must get permission from the author to use in ANY form.
modified on Thursday, May 1, 2008 8:43 AM - Minor typo/grammar fixes.
|
|
|
|
|