|
Hi. What MFC control should I use in order to put a text in such a way that some text should have different background color, and most important, there will be several selection in this text, all of them with the same background color ...
I have tried with CRichEditView, and I could set a text color for several selection, but not color for background, only for text:
SetWindowText(_T("Havecreatedonecomboclasstogetthecomboboxhandleandlistboxhandlevalue"));
CHARFORMAT cf;
cf.cbSize = sizeof(cf);
cf.dwMask = CFM_BOLD | CFM_COLOR;
cf.dwEffects = CFE_BOLD | ~CFE_AUTOCOLOR;
cf.crTextColor = RGB(0, 255, 0);
GetRichEditCtrl().SetSel(2, 5);
GetRichEditCtrl().SetSelectionCharFormat(cf);
cf.crTextColor = RGB(250, 55, 33);
GetRichEditCtrl().SetSel(10, 18);
GetRichEditCtrl().SetSelectionCharFormat(cf);
cf.crTextColor = RGB(250, 55, 33);
GetRichEditCtrl().SetSel(10, 18);
GetRichEditCtrl().SetSelectionCharFormat(cf);
GetRichEditCtrl().SetSel(-1, -1);
GetRichEditCtrl().SetReadOnly();
|
|
|
|
|
|
Yes, it goes. Here is the code, in case that everyone need it:
CHARFORMAT2 cf;
cf.cbSize = sizeof(cf);
cf.dwMask = CFM_BACKCOLOR | CFE_AUTOCOLOR;
cf.dwEffects = CFE_PROTECTED;
cf.crTextColor = RGB(64, 255, 33);
cf.crBackColor = RGB(240, 64, 64);
GetRichEditCtrl().SetSel(18, 28);
GetRichEditCtrl().SetSelectionCharFormat(cf);
GetRichEditCtrl().SetSel(-1, -1);
|
|
|
|
|
Hi Folkes
I am looking for some sandpit code to test an old fashioned CGI. Yes, I know it is old fashioned, but so am I.
Anyone any Idea?
Bram.
Bram van Kampen
|
|
|
|
|
Plz Help Me, I am trying to make a school project which is a search engine that takes input from the user and searches the entered word or sentence within the files available. There's no compile error in the program but the program is not searching correctly the file which has the data. If the entered string matches any sentence or string in the file stored then it should display the result.
But the problem is that the strcmp or stricmp or any function which searches for a match is not working.
I am using it with if & else statement for now... If the string is in the file then it should show found else not found but it only works if there is only one word in the file. If the file which is to be searched has lots of data off course in the text format it always shows not found but if it has only one word then it says found. Plz help Me If You Can.
void search()
{
char str2[100];
char str[100];
cout<<"write some text to search:";
gets(str);
ifstream i;
i.open("stud.txt");
while(!i.eof())
{
i>>str;
}
if(stricmp(str,str2)==0)
cout<<"found !";
else
cout<<"not found !";
getch();
}
modified 1-Dec-18 11:37am.
|
|
|
|
|
How could we possibly help without seeing your code?
|
|
|
|
|
You are reading the file and keyboard input into the same string.
|
|
|
|
|
Sorry for the incorrect edit.
The string was str which was getting the input and the string which reads the file is different as you said in the code.
I searched for the last word in the file and then it says found !. So that means it is working correctly but it's only searching for the last word in the file.
What to do ?
|
|
|
|
|
Put the test for equivalency inside the while loop. Currently the while loop reads all strings, when it exits the last string is in the variable, which you then test for.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
It's still searching for the last word Even after putting it into the while loop. Plz Help
|
|
|
|
|
Bro it's still the same. It's only searching for the last word of the file. Plz tell me what to do. I don't know what's happening
|
|
|
|
|
I am using a sample / example C++ (?) code and run into this, new to me , expression
array<Int32>^ DirMag;
I can ask Mrs Google. she knows stuff like that, but like to know if there are major advantages in using "string" array instead of customary C++ defined variable types.
In this example I would rather use "uint32_t" if it does not matter much.
Thanks
Cheers
|
|
|
|
|
This looks like "Managed C++", Microsoft's mutilation of C++ so that it fits into the .NET environment. IIRC, it was written as a "gateway drug" to get Standard C++ programmers to use the .NET environment, eventually graduating to C#.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
Thanks.
It is going to be an uphill battle to convert whatever it is to plain C++.
Will keep me of the street.
|
|
|
|
|
It's C++/CLI the ^ denotes a handle to a reference.
C++/CLI - Wikipedia[^]
The key point to understanding it
Quote: Operator overloading works analogously to standard C++. Every * becomes a ^, every & becomes an %, but the rest of the syntax is unchanged
You need to reverse that to turn it into C++ code you would recognize.
I suggest you also want int32_t not uint32_t as just from it's name I am guessing it is a signed direction
In vino veritas
modified 29-Nov-18 21:21pm.
|
|
|
|
|
i want learn this,but i cannot to do
|
|
|
|
|
Well its deep, so, possibly, not easy.
I would start from the very Wikipedia page on the topic: Deep learning.
|
|
|
|
|
My brain hurt just reading through the highlights of that article!
"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
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Luckily, I don't need to learn that.
|
|
|
|
|
I have tried implementing the tooltip using ctooltipctrl for drop-down list items on a combobox.
Have created one combo class to get the combo box handle and list box handle value.
From combobox I have called the presubclasswindow method of listbox and enabled tooltips using enabletooltips(true) and inside the list box class I override the ontoolhittest to get the row and rect area.
After this tnn_needtext notification has to be triggered to get the tooltip value.but in my case it is not getting triggered.
Please help me to solve this issue.
For the individual controls on dialogu box the tnn_needtext is getting triggered.
|
|
|
|
|
|
With the tracking tool tips the tooltip is getting displayed for each drop-down list item. Cant we implement the same tool tip functionality using CToolTipctrl.
I have tried all the possible scenarios to implement using ctooltipctrl, but it is not working for combo box. Except for Combo box the remaining controls i.e. listbox and other controls the Ctooltipctrl is working.
For combo box only we are not getting the TNN_NeedText notification
|
|
|
|
|
Well, the problem with "not getting TNN_NeedText" for the listbox appears to be because this listbox's parent is neither dialog nor combobox window. Instead it is a desktop!
However, TNN_NeedText like the other notifications are sent with WM_NOTIFY to the parent window.
|
|
|
|
|
Thanks victor for the providing the much needed answer
is there any other possibility to overcome this issue by using any other methods like setting the parent window as combo-box for dropdown list using setparent() mfc method.
|
|
|
|
|
You can find here[^] an extension of CComboBox, which do what you need, and more other.
|
|
|
|