 |
|
|
 |
|
 |
Anyone ported this to C# yet?
|
|
|
|
 |
|
|
 |
|
 |
Hi,
During my test-framework I use CListbox a lot. However, to see logging is difficult. New logging is coming a lot.. so I want to stop scrolling when I do manual things. Is it possible to stop the scroll in MFC when I do ::AddLine ?
Greetings from Mensfort
|
|
|
|
 |
|
|
 |
|
 |
You need to persist the font as a class variable, like this: CFont *font = m_List.GetFont();
LOGFONT logfont;
font->GetLogFont(&logfont);
_tcscpy(logfont.lfFaceName, _T("Courier New"));
m_font.CreateFontIndirect(&logfont); m_List.SetFont(&m_font);
|
|
|
|
 |
|
 |
Hi there
Does anyone know if there is a build in way to to this in VB.net ??
I can convert this project to .Net without poblems, but I hoped there i a standard class to do this in .Net.
Chears Jan
|
|
|
|
 |
|
 |
Excellent question and hopefully an answer comes soon
|
|
|
|
 |
|
 |
Hi Hans,
NIce code..Can u provide the port for the same in EVC++3.0..I am having little difficulties with the same...
|
|
|
|
 |
|
 |
Nice control, also v handy for quick clipboard support in ListBox.
Used it fine in VC++ .NET 2003 with a couple of tweaks/gotchas:
1) CColorPickerCB::GetSelectedColorName() in ColourPicker.cpp.
afxEmptyString not found - quick hack use _T("")
(Ok not an issue with CXListBox itself)
2) Remember to add the following for r-click menu popup:
m_ListMsg.SetContextMenuId(IDR_XLISTBOX);
in your class OnInitDialog()
(As Hans does in his eg!)
3) Couldn't find a quick menu copy/paste for IDR_XLISTBOX across different instances of VC .NET, would appreciate it if anyone can enlighten me!
Thanks Hans
|
|
|
|
 |
|
 |
OK, thanks for the info.
Best wishes,
Hans
|
|
|
|
 |
|
 |
Thanks for this colored listbox. A very useful thing. Can I get the item text color from the existing listbox in the code. GetText return "2" and "0" first characters even for colored items.
lara
|
|
|
|
 |
|
 |
I'm trying to use CXListBox outside the CDialog class and it gets failed since m_hWnd isn't initialized, how can I overcome this one?
|
|
|
|
 |
|
 |
Thanks for the code, it's fine, but needs to make some feature work correctly:
Sort does not work:
The control does not Sort items, even when I set the property to Sort.
The strong point is Colored Text with colored background.
Fine but the user cannot do a simple call to change the color of an existing string.
Something like this is needed:
SetBackgroundColor( SelectedItem, RGB(255,0,0) ); // just change the background color if an existing string.
SetTextColor( SelectedItem, RGB(0,0,255) ); // just change the text color if an existing string.
To change the color of an existing string I have to delete the string and add it again... That's convoluted...
Hans W
|
|
|
|
 |
|
 |
It's great!
Can you set different ;Pfonts for different items in the List Box ?
a C++ developer
|
|
|
|
 |
|
 |
I had to make the following changes to CXListBox::OnContextMenu in order to handle the context menu from my main windows message loop.
// If the list is not empty, pop open the context menu.
if(0 < this->GetCount())
{
CMenu menu;
if (!menu.LoadMenu(m_nContextMenuId))
{
TRACE(" ERROR failed to load %d\n", m_nContextMenuId);
return;
}
menu.GetSubMenu(0)->TrackPopupMenu(TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON,
point.x, point.y,
GetParent());
}
Just wanted to share my finding.
|
|
|
|
 |
|
 |
I like the color listbox and works great, but one thing I can not figure out. How to insert a string in color at a specified postion in the list. I can use the standard
insert function, but it only inserts a non colorized version of what I want to insert.
|
|
|
|
 |
|
 |
Never mind I figured it out myself and I should have thought about it before much to my embarrassment. What I did was to override the AddString and InsertString functions which was rediculously easy and I wish I had thought of it before I posted my original message. I just added the color variables to the function prototypes and disabled the forcing to black and white in InsertString and changed the black and white constants in AddString to the color variables. I don't usually override functions all that much which is why I did not think about it I guess. Anyway, the xlistbox works great now for inserting a string at a specific point in the list now with color.
|
|
|
|
 |
|
 |
Hello
I need a ListBox that will provide functionality of both single selection and multiple selection listboxes. That means I should be able to singly or multiply make selections in a listbox. I develop with Visual c++ 6.0. What would you suggest ? How would one make it ? I need not to play with colors or anything else. Any help would be greatly appreciated.
Nice Ozgurce
|
|
|
|
 |
|
 |
In dialog editor, bring up Properties dialog, go to Styles tab, and you will see "Selection" combo box that allows you to select Single, Multiple, Extended, or None. You can do this for any listbox, without making the listbox ownerdraw.
Best wishes,
Hans
|
|
|
|
 |
|
 |
Thank you for your help.
May I have one more very simple question if you don't mind.
Let us suppose I have a dialog and on this dialog there is a editbox(say m_edit1) and a button. When I enter some text in this editbox(m_edit1) and push the button, I want this action(buttons onclick event) to create a popup window on which there is an editbox(say m_edit2) to be filled with the information(text, string whatever) sent from the parent dialog(the info provided thru m_edit1).
What should I do ?
Should I declare m_edit1 public, private or what ?
Should I include first class's header file in the popup window ?
What should I write to pass the m_edit1's text into popup's m_edit2.text ?
Thank you for your help
Nice Özgürce
|
|
|
|
 |
|
 |
You can find how to do this in any good book on MFC. The steps involved are:
1. Declare an editbox IDC_EDIT1 on dialog 1.
2. Go to View | ClassWizard and click on the Member Variable tab.
3. Select IDC_EDIT1, and then click Add Variable.
4. For Member variable name, enter m_Edit1; for category, select control; CEdit should be displayed as Variable type.
5. Click on OK, click on OK.
6. ClassWizard has added the variable m_Edit1 to the Dialog 1 header file.
7. Now create the popup dialog, Dialog 2.
8. Declare an editbox IDC_EDIT2 on dialog 2.
9. Go to View | ClassWizard and click on the Member Variable tab.
10. Select IDC_EDIT2, and then click Add Variable.
11. For Member variable name, enter m_strValue; for category, select value; for Variable type, select CString.
12. Click on OK, click on OK.
13. ClassWizard has added the variable m_strValue to the Dialog 2 header file.
14. To display Dialog 2, do this:
CString strEdit1;
m_Edit1.GetWindowText(strEdit1); // get contents of IDC_EDIT1
CDialog2 dlg;
dlg.m_strValue = strEdit1;
dlg.DoModal(); // Dialog 2 will transfer m_strValue to edit box
15. Dialog 2 is now displayed with the contents of IDC_EDIT1 in IDC_EDIT2.
|
|
|
|
 |
|
 |
Super !
Thank you very much !
|
|
|
|
 |
|
 |
Hi again I don't know if this is the right platz to ask a similar question but since i get answers very fast here thanks to Mr. Hans Dietrich, I see no problem with submitting my question here. Is it possible to pass contents(items) of a listbox (on parent window) to a combobox (on popup window) DIRECTLY, like below ? popup dlg; dlg.m_combo1 = m_list2cs; dlg.DoModal(); where m_combo1 and m_list2cs (public variables for controls associated) can only be selected as "category=value" and "variable type=CString" with ClassWizard. Is this not possible with classwizard or with Visual C++ 6.0. Because otherwise I will first have to put items of listbox into a CString array with some delimiter, pass it to popup and unzip individual items into the combox. Is this the most suitable way ? Thanks a lot, Nice Özgürce
|
|
|
|
 |
|
 |
Hello,
I used your source code. I created a variable using CXListBox, i use GetDlgItem for control list box. I added strings using AddLine. The listbox property OWNERDRAW is set to Fixed and HASSTRINGS is True. But the program runs i do not see the text.
My feeling is the DrawItem is not being overwritten and the DrawItem in your class is not being used to draw the listbox.
Can you help me out what i exactly need to. I am new to this
Thanks,
Your Anger is a Gift
|
|
|
|
 |