|
Use the CBS_SORT style when creating your combo box and the contents will be displayed in sorted order.
It's time for a new signature.
|
|
|
|
|
Hi sir,
I have selected the CBS_SORT,its sorting correctly.
My doubt is if we type manually in the edit box for ex : "a"
In the combbox only the data starting from "a" should be seen in the dropdown Combobox
Ex
a,aa,aa
Not the b,bb,bbb values
I hope you got it now.
Thanks
Raj
|
|
|
|
|
OK, I misunderstood your question. In this case you will need to filter the data in the combobox yourself, I don't know of any built in message that allows you to do this.
It's time for a new signature.
|
|
|
|
|
OK, I misunderstood your question. In this case you will need to filter the data in the combobox yourself, I don't know of any built in message that allows you to do this.<br />
Hi sir
I am not clear with this,"Filter the data in combo box" in the sense.
Whetheir i have to read the data and sort it.
Thanks
Raj
|
|
|
|
|
You can check the suggestion of Anand below, which may be the solution to your problem. Alternatively to do it yourself you will need to implement a catch for the CBN_DROPDOWN notification. You then populate the list items based on the contents of the edit box. There are problems of course when the user then changes the content of the edit box by backspace and retyping.
It's time for a new signature.
|
|
|
|
|
Hi sir,
Thanks for all your help.I have found the solution.
I am reading all the character from combo and storing it in map.
then i am reading the character from combo and Find() in given whole map.
I am tryig this code.
CString strValue;
CString strTemp;
m_CtrlComboID.GetWindowText(strValue);
std::map<CString,CString>::iterator it=m_mapId.begin();
m_CtrlComboID.ResetContent();
for(; it!=m_mapId.end(); it++)
{
strTemp = it->first;
strValue.MakeUpper();
if(strTemp.Find(strValue)==0)
m_PatientID.AddString(strTemp);
}
m_CtrlComboID.SetWindowText(strValue);
m_CtrlComboID.ShowDropDown();
the problem i am facing is,
1)The first string is getting set in the ComboBox.
2)when i type the first character in combo,it is getting the strings
related to the first character.
but i am not able to type in the second character,as the cursor is going in the first position.
The character which i have typed later is going first.
For Ex: First i will type the character as "P",
Second if i type "A" character in combo,its going before "P"
i.e "AP",but i need as "PA".
I am bit confused,
any suggestions
Thanks
Raj
|
|
|
|
|
Sorry, but I don't have MFC so I cannot reproduce the problem on my system. I wonder if any other kind reader has more experience with CComboBox.
It's time for a new signature.
|
|
|
|
|
If i undrstood you correctly, you want an Auto Complete functionality which we see many times in web based applications (In Google Search if we typed "as" then strings starting with "as" will appear in drop down automatically). For this to achieve, refer here[^], see if this is useful any way.
Good Luck.
Thanks,
Anand.
|
|
|
|
|
Hi sir,
Thanks for your reply.
Actually i have combobox where i will read some data from DataBase.
I have set the properties to SORT,DropDown.
When i click the dropdown,its sorting and showing the values in the combobox(dropdown) correctly.
But what i need if i type manually any data in Combo(editable)
Example "a",i should get the the names starting from "a" and show the list in ComboNox(dropdown).
I hope thant now i am clear.
I am in doubt.whethier i have to change the properties of combobox or
store all the values in array and sort it according.
Plz do the needful
Thanks
Sharan
|
|
|
|
|
See here.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Hi sir,
Thanks for your reply,For me sorting is working properly.
My problem is only the cursor is reseting in the first position sir.Its not coming after the character typed
Thanks
Raj
|
|
|
|
|
Great, I also faced the same problem but i remember it gets fixed by some flags, please refer to article again and the additional flags.
Keep it up.
Thanks,
Anand.
|
|
|
|
|
Hello sir,
I tried running that demo version.
but i got the error as "cannot open include file 'atlres.h'."
From where i will get the header file.
Thanks
Sharan
|
|
|
|
|
Hi all,
please can anybody tell me how can i convert from Decimal to Ascii or Binary to Ascii?
waiting for ur valuable suggestions.
if possible please provide me any example.
thanks in advance.
|
|
|
|
|
Once again, your question is really vague. What do you mean by Decimal and Binary ? Do you mean a string containing a decimal or binary representation of a number ? Because a decimal or a binary number doesn't exist. A number is a number and is independant of its representation. So please, clarify your question, because I think you are getting confused about this concept.
|
|
|
|
|
Actully i have a value int/Long t=86;ascii value of 86 is V,
so i want to convert t and getting result as "V"
|
|
|
|
|
It seems that you are confused about hexadecimal and binary notations. Those are only representations of a number, and they don't have any influence on the number. In your example, t has a value of 86 (decimal), 0x56 (hexa) and 0b01010110(binary). These are different representations of the same number. So, your question is wrong, you simply want to convert a number to it's corresponding ASCII representation.
For that part, it is easy: simply store the value in a character and print it. It will be automatically displayed as a character (thus, using the symbol in the ASCII table).
But, where do you want to display this character ? Because here also, the ASCII representation is just a way to represent a character. The value contained in the variable doesn't change (it is still 86).
|
|
|
|
|
What are you asking for?
If you need the hexadecimal representation of (say) a byte then you may use sprintf , for instance:
char buf[10];
unsigned char c = 65;
sprintf(buf, "%02X",c);
printf("%s\n");
outputs
41
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: char buf[10];unsigned char c = 65;sprintf(buf, "%02X",c);printf("%s\n");
outputs
41
here i want output print A
so please tell me how can i do this
|
|
|
|
|
printf("%c\n", c)
Are you really asking for this?
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
modified on Friday, June 25, 2010 4:08 AM
|
|
|
|
|
|
I think you should spend some time studying this paper[^] and any others on the same subject. You seem to be working on programming with very little understanding of how information is held and manipulated in a computer - either because you have missed something in your education or because you are very young.
It's time for a new signature.
|
|
|
|
|
Hi Friends
I need to implement "Pages Per Sheet " option ( The same option as in MS Word Print Dialog ) in Applications Print Dialog . My Application is written in VC++ and MFC .
I searched in the net ,but I am not getting any Information on how to implement .
I would be really grateful,if I can get any inputs on how I can proceed .
Regards,
Jack
|
|
|
|
|
I have never used this but I would assume you need to do some calculations based on this value to resize your logical page. You then need to scale your output to the size of the new logical page and set your start point for each page to its relative position on the physical page. I usually start with problems such as this by drawing a rough representation on a sheet of paper and figure it out from there.
It's time for a new signature.
|
|
|
|
|
Thanks Richard for the inputs............I will try to do as you have suggested..........
|
|
|
|