|
Isn't a list control (a list box or a list view ) more appropriate, is it?
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.
[my articles]
|
|
|
|
|
LCI wrote: I tried using the control variable and the value variable for my edit control to display these items. No matter what i try , it only displays the first item and not the rest.
I have used the method "SetWindowText"
How are you doing this?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I simply have a control variable for my edit control
call it m_Control.
I have a string variable for that same edit control.
call it m_strValue.
I do something like
//using the string var
for (int lop=1; ;lop<100;lop++)
{
m_strValue = data[lop];
UpdateData(FALSE);
}
///////OR
for (int lop=1; ;lop<100;lop++)
{
m_Control.SetWindowText((LPCSTR)data[lop]);
UpdateData(FALSE);
}
|
|
|
|
|
Neither of these will preserve what is currently in the edit control.
LCI wrote: m_Control.SetWindowText((LPCSTR)data[lop]);
UpdateData(FALSE);
When using a CEdit control, or any other time for that matter, UpdateData() is not necessary.
You can do something like:
for (int lop = 1; lop < 100; lop++)
{
CString str;
m_Control.GetWindowText(str);
str += data[lop];
m_Control.SetWindowText(str);
} Or you could just continually add to the end of the edit control as has already been suggested.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Since you are trying to update a window while you are in a tight loop, you need to realize that the window will not process any messages until the loop completes. The UpdateData puts a message in the queue to be processed, but it isn't processed immediately.
To overcome this, try
for (int lop=1; ;lop<100;lop++)
{
m_Control.SetWindowText((LPCSTR)data[lop]);
UpdateData(FALSE);
m_Control.UpdateWindow();
}
The call to UpdateWindow bypasses the normal message queue and causes the window to repaint immediately.
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
LCI wrote: it only displays the first item
Do you have the textbox set to multiline?
Or use a listbox as was mentioned.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
|
|
|
|
|
|
From MSDN (here[^]):
So, set the current selection (SetCell) to the last character and then replace the current selection by the new text (ReplaceSel). This way, you don't erase what was there previously.
modified on Tuesday, January 22, 2008 10:50:29 AM
|
|
|
|
|
dear all
sometimes i want to calculate 3 amont minimum, for example: 1,2,3. i want to calculate minimum of 1,2,3, but sometimes i want to calculate minimum of 5,6,7,8,9,10, how can i define a function or other way to calculate such miminum? thanks a lot.
Li Zhiyuan
5/10/2006
|
|
|
|
|
How would you do it manually (without a computer) ?
Start by putting all numbers in a bag, then pick the first number; this can be considered the minimum value.
continue picking numbers, if the number is smaller than the current minimum value, then it becomes the current
minimum value; continue with the rest of the numbers.
|
|
|
|
|
Hint: write a function accepting as arguments an array of numbers and its element count.
BTW if you want to feel the thrill of a more advanced context, have a look at http://support.microsoft.com/?scid=kb%3Ben-us%3B156619&x=12&y=14[^]
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.
[my articles]
|
|
|
|
|
li zhiyuan wrote: how can i define a...way to calculate such miminum?
Put your numbers in a text file of some sort (e.g., num.dat). Create a console application using:
void main( void )
{
int nNumber,
nMin = INT_MAX;
while (fscanf(stdin, "%d", &nNumber) != EOF)
{
if (nNumber < nMin)
nMin = nNumber;
}
printf("Min = %d\n", nMin);
} And then type one of the following at a command prompt:
type num.dat | prog.exe
prog.exe < num.dat
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Great!
But I think he can keep things simpler if:
(1) Creates a database engine, i.e. MySqlEngine.exe .
(2) Creates a database and a table, namely MyNumbersDatabase and MyNumbersTable .
(3) inserts the numbers into the NUM column of the MyNumbersTable table.
(4) issue an SQL query such as SELECT MAX(NUM) FROM MyNumbersTable
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.
[my articles]
|
|
|
|
|
I am using Gradient fill
i mproblem is how to fill single color gradient
what i am trying to say is ... whats the way to fill single color gradient
other than reg r blue r grean?
when i mix up the colors it not coming properly
but i can fill red r blue r grean single color
but i wanna fill with sky blue color but not dark blue color
please some one let me know how to do that .. i know know there is a way to do ... can some one give me info
|
|
|
|
|
sarat wrote: but i wanna fill with sky blue color but not dark blue color
Then specify two (different) light blue tones for both the starting and ending color.
What is the difficulty about?
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.
[my articles]
|
|
|
|
|
can i send u a mail
i wanna post and attach the screen shots to exactly the prob i am facing
ok
|
|
|
|
|
what to fill in the TRIVERTEX structure for sky blue color
i wanna paint a dialog with starting with sky blue color at the botton and ending with white color at the top
what r the hex values i need to assign for bule grean and red of the following structure
here is the sample code... whic gives light grean color
please some one hlep me
TRIVERTEX vertex[2] ;
vertex[0].x = 0;
vertex[0].y = 0;
vertex[0].Red = 0x0000;
vertex[0].Green = 0x8000;
vertex[0].Blue = 0x8000;
vertex[0].Alpha = 0x0000;
vertex[1].x = 300;
vertex[1].y = 80;
vertex[1].Red = 0x0000;
vertex[1].Green = 0xd000;
vertex[1].Blue = 0xd000;
vertex[1].Alpha = 0x0000;
|
|
|
|
|
Heyy guys
i got it ....
just we need to append 00 to hex value
means if the hex value is FB we need to append "00" -> FB00
but dont think abt actual FB00 value ... u will get confused ... be wat ever it is .. append "00" to Hex val
|
|
|
|
|
Hi all,
I am working on a VC++ project using VS2003 which comprises of several nested namespaces, classes, and type definitions. I have a problem which I really do not understand, as far as I am aware, this SHOULD work
This Works:
<br />
namespace Root<br />
{<br />
class MyClass<br />
{<br />
public:<br />
MyClass(int input = Nested::TemplateClass<int>::constant_value);<br />
...<br />
};<br />
};<br />
But this DOESNT
<br />
namespace Root<br />
{<br />
typedef Root::Nested::TemplateClass<int> NESTED_CLASS;<br />
<br />
class MyClass<br />
{<br />
public:<br />
MyClass(int input = NESTED_CLASS::constant_value);<br />
};<br />
};<br />
Compiler Errors (Edited, forgot to post originally)
Sorry, I meant to have pasted the compiler errors . Here they are:
error C2065: 'constant_value' : undeclared identifier
error C2653: 'TemplateClass<int>' : is not a class or namespace name
The project that I am working on is very big, and has a lot of files. I am unable to reproduce the same problem in a simple test project.
Does anybody know what might be the cause of this weird problem?
Cheers!
Lea Hayes
modified on Tuesday, January 22, 2008 8:17:40 AM
|
|
|
|
|
IMHO one of the points is: do you really need such a mess?
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.
[my articles]
|
|
|
|
|
Hi,
The design behind the software engineering works quite well (imo). Related classes are grouped within their respective namespaces, and the classes are reasonably straightforward to use.
I have found that the following works, so defines remain an option, but I would have rather used typedefs:
<br />
#define NESTED_CLASS Nested::TemplateClass<int><br />
namespace Root<br />
{<br />
class MyClass<br />
{<br />
public:<br />
MyClass(int input = NESTED_CLASS::constant_value);<br />
...<br />
};<br />
};<br />
|
|
|
|
|
lhayes00 wrote: The design behind the software engineering works quite well (imo).
I'm quite sure it works.
Maybe using the original typedef outside namespace block works as well as the #define .
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.
[my articles]
|
|
|
|
|
I think that I have found the root of the problem...
The template class has an enum inside it:
template<typename _Ty> class TemplateClass<br />
{<br />
public:<br />
enum ConstantValue<br />
{<br />
constant_value = 17<br />
};<br />
};
The type definition works when the enum is taken out of the template class. So the following works:
enum ConstantValue { constant_Value = 17 };<br />
<br />
template<typename _Ty> class TemplateClass<br />
{<br />
public:<br />
...<br />
};<br />
<br />
...<br />
<br />
typedef Root::Nested::TemplateClass<int> NESTED_CLASS;
I still do not understand why this is, but at least I have a solution now. I found a BUG report on the Microsoft website which addresses this very issue with template functions, the remedee there is to typedef the enum...typedef'ing the enum within the template class didn't improve the situation for me though.
http://support.microsoft.com/kb/125495[^]">
I thought it was worth posting the solution in case somebody else has a similar issue. It would be interesting if someone was able to give a reason as to why this problem occurs.
Thanks for your advice.
|
|
|
|
|
But why do you need anymore the typedef (now you have a not-nested enum )?
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.
[my articles]
|
|
|
|
|
I only demonstrated the part which was not compiling, the template class in question does get used extensively when assigned to particular types.
for example,
typedef TemplateClass<int> IntVersion;<br />
typedef TemplateClass<float> FloatVersion;<br />
<br />
IntVersion a;<br />
a.foo();<br />
<br />
Bar(a);
Obviously the enum can now be accessed via the appropriate namespace. Before it was accessed via the template class (which in some ways was better because it grouped it with context), but having it in the namespace isn't exactly end of the world.
The template class will still be used for its primary purposes.
|
|
|
|