|
Hi,
I have a listbox containing strings items. When the user selects an item in the listbox using keyboard character, there is a vertical cursor/caret displayed at the end of first character. E.g. If the listbox has String items as "One", "Two", "Three", "Four", "Five", "Six", "Seven" etc... and the user press character "s/S" after bringing the focus on the listbox, a vertical line similar to the one shown in the following word "S|ix" is dispalyed.
Basically a veritical line is shown after the first character of the item if it exists in the listbox
How do I get rid of this cursor? I have tried using "HideCaret", SetCaretPos API in selectchange message handler, onfocus message handler but the vertical line is still vistible, though it goes away automatically in a second or two, I do not want it to be displayed at anytime.
Thanks.
|
|
|
|
|
What does the code look like that creates the control?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
This episode brought to you by the letter Z
|
|
|
|
|
Hi Mark,
It is a standard code generated with VC++ 2005. I had simply created a dialog based application. Added a listbox to the dialog and added the code in the InitDialog method to insert the strings in the listbox. When I compile and execute the application the dilaog comes up with the listbox and strings in it, nothing special other than this. Anyways you can see the InitDialog code below where the list box is initialized with strings
CListBoxDialog::OnInitDialog()
{
CDialog::OnInitDialog();
// Other code add by the wizard....
// my code
const TCHAR* Strings[10] = {_T("One"),
_T("Two"),
_T("Three"),
_T("Four"),
_T("Five"),
_T("Six"),
_T("Seven"),
_T("Eight"),
_T("Nine"),
_T("Ten") };
for(int i = 0; i < 10; i ++)
{
m_List.AddString(Strings[i]);
}
return TRUE; // return TRUE unless you set the focus to a control
I didn't made any changes in the properties of the listbox.
Thanks
}
|
|
|
|
|
Thanks! Can you post the code from the resource (rc) file for the dialog resource?
That's where the control styles are.
I'm curious because I can't get a caret to appear in a listbox.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
This episode brought to you by the letter Z
|
|
|
|
|
Hi Mark,
Here is the code for the Dialog resource
IDD_LISTBOX_DIALOG DIALOGEX 0, 0, 320, 200
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "ListBox"
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,263,7,50,16
PUSHBUTTON "Cancel",IDCANCEL,263,25,50,16
LISTBOX IDC_LIST,72,31,90,113,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
END
If you want I can send you the zipped code at your mail address
Thanks
|
|
|
|
|
Just what I needed, thanks!
I've never seen that before. I had to look real close to see the caret.
For me, the caret blinks once and goes away (I'm on XP Pro SP2).
I removed the SORT style (set the Sort property to false in the resource editor) from the listbox
control and I don't see the caret now.
I'll look at it more in a bit...
Mark
Mark Salsbery
Microsoft MVP - Visual C++
This episode brought to you by the letter Z
|
|
|
|
|
Thanks Mark.
Strange I also do not see the caret if I set the SORT style to false !!
I am also on WinXP Pro SP2 and it goes for me also with in a second. But I had hard time explaining to my usability team about the caret stuff, they are bit rigid on it not appearing at all. And since I also do not know the reason for the caret to appear I thought of creating a seprate project and try to solve the issue and it seems a bit overkill to go for ownerdraw listbox for this issue
But after trying for sometime without luck I had posted it here. Anyways I now have partial solution and till I do not find a proper solution/reason I can set the listbox SORT style to false, sort the items externally and add it to the list.
Regards
|
|
|
|
|
The docs for the control mention the caret but I think it's silly on a control that you can't
enter text
WM_SETFOCUS Turns the caret on and sends an LBN_SETFOCUS notification message to the owner of the
list box.
WM_KILLFOCUS Turns the caret off and destroys it. Sends an LBN_KILLFOCUS notification message to
the owner of the list box.
WM_KEYDOWN Processes virtual keys for scrolling. The virtual key is the index of the item to move
the caret to. The selection is not changed.
Cheers,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
This episode brought to you by the letter Z
|
|
|
|
|
Hi Mark,
Thanks for the insights into Listbox working
Regards
|
|
|
|
|
How I can convert CString to GUID ?
Ex :
CString str = "{EB533751-63E2-46c4-B0C7-F83157180BB6}";<br />
GUID guiFromStr = ?
Thanks,
Ohad
|
|
|
|
|
See there http://msdn2.microsoft.com/en-us/library/aa379336.aspx[^].
Please note the Requirements section.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
|
USBInterface.obj : error LNK2001: unresolved external symbol __imp__UuidFromStringA@8
DLL/Debug/USBDetectorD.dll : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
|
|
|
|
|
you have to use Rpcrt4.lib as stated in the Requirements section of the MSDN page.
(Menu Project->Settings , select the Link , add Rpcrt4.lib in the Object/Library modules textbox).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Specify the Rpcrt4.lib in the project settings->Link->object/library modules
|
|
|
|
|
|
Thanks you all. Its working OK.
|
|
|
|
|
Hi everyone,
I am using OLEDB APIs (such as CTable, CDynamicAccessor etc) for retrieving data from a text file (say abc.txt).
The problem is while retrieving date value.
When date in "Regional and Language Options in Control Panel" is "M/d/yyyy" format, GetValue of CDynamicAccessor returns correct date value. If i change date format to "d/M/yyyy", GetValue returns NULL.
Can anyone tell me the reason for this behaviour?
Thanks
-- modified at 3:17 Monday 9th July, 2007
|
|
|
|
|
What format is the date value inside the text file?
The problem recognising D/M/Y versus M/D/Y is that there are a large number of values (where both M and D are <= 12) where it cannot be categorically determined which format is in use.
If the data driver you are using is expecting M/d/yyyy, then in theory you could call SetThreadLocale() while you do the retrieval, and set it back again afterwards, but there's no guarantee that it isn't using LOCALE_SYSTEM_DEFAULT or LOCALE_USER_DEFAULT, rather than calling GetThreadLocale() internally.
Steve S
Developer for hire
|
|
|
|
|
Steve S wrote: What format is the date value inside the text file?
"M/d/yyyy" format
Any solution??
|
|
|
|
|
I am developing a multilingual software. In my software I can changed language to Arabic. So I install a "Arabic" input method. When I tried to input Arabic in one of my CEdit control, the CEdit didn't accept Arabic.
It seems OK, if I type Arabic here.
Arabic: سيبسايبعهصقثعخرتؤمترهقفثتمبتخشهقثهعخ
Is there any special property of CEdit that I need to set? Expect somebody could help me solve this problem.
|
|
|
|
|
Why you dont use of CRichEdit?
|
|
|
|
|
create a font using arabic character set and set the font to the edit box. then u can display the arabic font in editbox.
Regards,
Ram
|
|
|
|
|
I think we have a little problem if he creates a font for editbox it will be work but if he runs his program on the a computer that has arabic language for OS so I think he will be problem.
|
|
|
|
|
Please check whether you have enabled this option
control panel->Regional and Language Settings-> Language Tab-> Tick the check box "Install files for East Asian languages"
|
|
|
|