|
ldsdbomber wrote: ...but would just like to know the correct method to programmatically set a row to be selected...
Use the LVM_SETITEM message.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Is that via a SendMessage David? I've not used that before very much
|
|
|
|
|
ldsdbomber wrote: Is that via a SendMessage David?
Yes, if you are not using MFC.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
You can use:
SetItemState(index,LVIS_SELECTED | LVIS_FOCUSED,LVIS_SELECTED | LVIS_FOCUSED);
|
|
|
|
|
|
I have a property sheet with wizard style.
At one place, I need to disable the Finish button. The code doesn't work and the Finish button is enabled.
But if I put a message box before calling the SetWizardButton routine, it works.
I tried with invalidate method so as to refresh the current windows, but I guess I am missing something.
Any pointers?
evil triumphs when good people sit quiet..
|
|
|
|
|
misha_grewal wrote: The code doesn't work and the Finish button is enabled.
What does the code look like?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
oK I digged into the problem a little bit
Is it a message queue problem?
Code ===
pWizard->SetWizardButtons(PSWIZB_BACK);
CWnd* pButton = pWizard->GetDlgItem(ID_WIZFINISH);
if (pButton) {
// this call doesn't work
pButton->EnableWindow(FALSE);
}
but if you put a message box before the call, it works, as in
if (pButton) {
AfxMessageBox(_T("text"));
// this call now WORKS
pButton->EnableWindow(FALSE);
}
Code ends ==
On the other hand, if I call a "ShowWindow" method instead of EnableWindow, it works fine with or without the message box.
What happens in EnableWindow?
|
|
|
|
|
misha_grewal wrote: CWnd* pButton = pWizard->GetDlgItem(ID_WIZFINISH);
if (pButton) {
// this call doesn't work
pButton->EnableWindow(FALSE);
Why aren't you using:
pWizard->SetWizardButtons(PSWIZB_DISABLEDFINISH);
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks much
it works with this call
i m really stupid
|
|
|
|
|
In my Visual Studi 2003 C++ project I've got a weird bug. I have a 'normal' for loop:
int i = 0 ;
for ( i = 0 ; i < m_NumberOfObjects ; i++ ) ;
{
m_ListObjects[i]->DoStuff ( ) ;
}
where m_NumberOfObjects is a static int (member variable) within the class.
The problem is the for loop seems o ignore the entry criteria so if i = 0 and m_NumberOfObjects = 0 is still goes in (even with i = 1 and m_NumberOfObjects replaced with a 0)
Has anyone came across this? or know what is going wrong?
TIA,
Andy
|
|
|
|
|
doesn't matter I'm an idiot, stray semi-colon
|
|
|
|
|
mcsherry wrote: stray semi-colon
Don't let 'em get away from you. They're feisty little buggers
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Mark Salsbery wrote: Don't let 'em get away from you. They're feisty little buggers
|
|
|
|
|
You should not put the ";" after the for loop Dear...
and you don't normally come across such issues if you know how does a for loop work:->
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
The bug is the semicolon ; following the for statement: an empty statement is controlled by the for expression while the code block inside the curly braces {} is always executed.
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.
|
|
|
|
|
I suspect you're suffering from a change in the syntax between VC6 and Visual Studio 2003 C++ combined with a stray semi colon. The scope of counters in for loops (i in your case ) has changed so that if they're declared in the loop they can't escape from the loop. You possibly have 2 i's happening here in different scopes which is to say the least. I now use this syntax to try and be both 'correct' and compatible
<br />
int i = 0;<br />
for( ; i < m_NumberOfObjects; i++ )
{<br />
m_ListObjects[i]->DoStuff();<br />
}<br />
<br />
for( int i; i < m_NumberOfObjects; i++ )
{<br />
m_ListObjects[i]->DoStuff();<br />
}<br />
The extra ; has caused the intended loop code to happen only once and declaring the i outside has let you get away with it Perhaps that's why they changed it.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
thanks all for your replies, obviously just the stray semi-colon (couldn't spot it after looking at the code for ages, post the question on here and spot it straightaway always the same!)
Andy,
|
|
|
|
|
I know the feeling.
Therefor I sometimes use one of my colleagues to wine about some extreme strange bug.
They are willing to help. Once I show them the piece of code and start explaining what it suppose to do. I start swearing at my own stupidity. Time on time i have found the bug before they do.
codito ergo sum
|
|
|
|
|
mcsherry wrote:
int i = 0 ;
for ( i = 0 ; i < m_NumberOfObjects ; i++ ) ;
{
m_ListObjects[i]->DoStuff ( ) ;
}
there you are. The semi colon in the second line is causing problems to you.
sorry, i didn't see that you figured it out by yourself.
Regards,
Vijay.
God may not give us what we 'want', but he surely gives us what we 'need'.
|
|
|
|
|
The compiler should have given you a warning about that semicolon. If not, turn warnings back on.
|
|
|
|
|
I don't think so Mike. That looks like completely valid C code with the semi-colon in there.
That one would drive me nuts if I didn't see it right away in my code LOL
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi All
i want to detect at run time what kind of device is connected to USB port(like if Digital camera is connected then it shows Digital camera etc.)like how our windows is showing(if you cannect scanner to USB port then in My computer you can view in "Type" Image scanner.
i got something "SystemParametersInfo" but i dont know how will i use it and wheter it is useful or not
Thanks in advance
R e h a n
|
|
|
|
|
Basically the symbolic link for the device should have the GUID which should be unique per type .
Look into plug and play notifications on Windows
Engineering is the effort !
|
|
|
|
|
I want to change the color of static control to white.As well as in the static controls the text also should be visible.
CStatic temp = new CStatic();
temp->Create(text ,style |SS_LEFT ,pos ,this ,m_iAutoControlID);
bhw
|
|
|
|