|
Use SetCurSel() and SetSet().
Kuphryn
|
|
|
|
|
How? They aren't members of CListCtrl
|
|
|
|
|
Oh. Those functions work for a list box, not a list control.
Kuphryn
|
|
|
|
|
That looks right to me (although you're using a list view control, not a list box, they are different things). If your control doesn't have the LVS_SHOWSELALWAYS style, the selection won't be visible when the control does not have the focus, so maybe that's causing the problem.
--Mike--
Just released - RightClick-Encrypt v1.4 - Adds fast & easy file encryption to Explorer
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Thanks, I think that did the trick
|
|
|
|
|
any ptrs to exmaple using MSFlexGrid with each cell displaying a combo box control upon clicking?
Thanks
|
|
|
|
|
I want to display the database records in the listbox. All I have done with database is specifiying the database support while creating the project so that I get a record by record display.
Could anyone tell how to implement it?
Thank You
|
|
|
|
|
A lot depends on what kind of database access you are using and what kind of database you are accessing. ADO is the easiest method and is well documented with examples at http://www.codeproject.com/database/
Michael
Programming is great. First they pay you to introduce bugs into software. Then they pay you to remove them again.
|
|
|
|
|
Looking for an ACM (Audio Compression Manager) tutorial somewhere. I've just made an app that enumerates all the different drivers and formats, but i don't know how to convert from one format to another.
Thanks
-Rune Svendsen
|
|
|
|
|
Hi
do you know how to include inline assembler code in Dev-C++?
I tried __asm {}, _asm {}, asm {}, __asm__ {}, but nothing works...
-Dominik
|
|
|
|
|
From MSDN:
int power2( int num, int power )
{
__asm
{
mov eax, num ; Get first argument
mov ecx, power ; Get second argument
shl eax, cl ; EAX = EAX * ( 2 to the power of CL )
}
}
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Your example doesn't work.
Error: "parse error before { in line xxx"
((
-Dominik
|
|
|
|
|
|
I want to create a array (CArray, CPtrArray, ...) of pointers of a class, like "CMeasureItem*". I have no experience with arrays in mfc, so could anyone tell me what kind of mfc array I should use?!?!
CTypedPtrArray<CPtrArray, CMeasurementItem*> m_measureItems; ????
or
CArray<CMeasurementItem*, CMeasurementItem*> m_measureItems; ????
...
????
--
Nice greets, Daniel.
--
Nice greets, Daniel.
|
|
|
|
|
If you don't mind using STL, you'd have to use a std::vector<CMeasureItem *> .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Don't use MFC arrays at all - they are crap. Use std::vector. I have some tutorials on CP, and there are others, too.
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Cats, and most other animals apart from mad cows can write fully functional vb code. - Simon Walton - 6-Aug-2002
|
|
|
|
|
I want to create a array (CArray, CPtrArray, ...) of pointer to a class, like "CMeasureItems*". I have no experience with arrays in mfc, so could anyone tell me what kind of mfc array I should use?!?!
CTypedPtrArray<cptrarray, cmeasurementitem*=""> m_measureItems; ????
or
CArray<cmeasurementitem*, cmeasurementitem*=""> m_measureItems; ????
...
????
--
Nice greets, Daniel.
|
|
|
|
|
try std::vector<cmeasureitems *="">
|
|
|
|
|
Hi...
With MFC you've 3 types of simple container
1. Array : with CArray
2. List : with CList (very useful)
3. Map : with CMap
You've also containers of typed pointers. For example CTypedPtrList
With CArray, use this command for an array of CPoint named PointArray
CArray<CPoint, CPoint&> PointArray;
To add a point:
PointArray.Add(aPoint);
Advice: It's recommended to use the method SetSize() for initialize the size of the array and avoid a lot of reallocation.
To extract an element:
aPoint = PointArray.GetAt(2);
To change an element:
PointArray.SetAt(3, NewPoint); // stock the NewPoint in the place of the 4th element
But I find CList more useful...
With CList, use this comand for a list of CPoint named PointList
CList<CPoint, CPoint&> PointList;
To add a point:
PointList.AddTail(aPoint); // in the end of the list
PointList.AddHead(aPoint); // in the head of the list
To insert a point:
PointList.InsertBefore(aPosition, ThePoint); // before the aPosition (type = POSITION)
PointList.InsertAfter(aPosition, ThePoint); // afterthe aPosition (type = POSITION)
The GetNext() return a value of type POSITION which is the position of the next pointed element.
For an iteration inside the list use this loop:
CPoint CurrentPoint(0,0);<br />
POSITION aPosition = PointList.GetHeadPosition();<br />
while(aPosition)<br />
{<br />
CurrentPoint = PointList.GetNext(aPosition);<br />
}
For more information... MSDN of course (but it's really a mess)
Hello World!!!
from Raphaël
|
|
|
|
|
Raphaël Kindt wrote:
But I find CList more useful...
Leaving aside that MFC containers are garbage, are you aware of the COST of list compared to an array ? A list is quicker to insert or remove, especially in the middle. It is far slower though, when you're looking up items, because it needs to step from one to another until it finds the one it wants. For this reason, stl::list has it's own sort, instead of the faster sort provided for random access iterators, that is, containers where you can go direct to the item you have the index for instead of counting up to it.
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Cats, and most other animals apart from mad cows can write fully functional vb code. - Simon Walton - 6-Aug-2002
|
|
|
|
|
of course...
I did not want anything to impose by saying that.
All belong to the application... (for mine CList was useful. But what you say is true)
I am not an expert with STL but I learns. Many of my friends say only good things on the STL...
Hello World!!!
from Raphaël
|
|
|
|
|
If you want another solution (faster and managing the memory better) use STL (Standard Template Library)...
Hello World!!!
from Raphaël
|
|
|
|
|
I have ADO in my project with a #import msado25.tlb. I see that if I want to peek into my db and check the name of the table, I need to use ADOX. But when I do the #import msadox.dll I get redefinition problems.
So, is there a way to get the table name using only ADO. If not how do I get ADOX and ADO to reconcile. As soon as i put in the #import for ADOX I get errors of redefinition!
Thanks,
Need to know this desperately.
ns
|
|
|
|
|
#import "C:\Program Files\Common Files\System\ADO\msado15.dll" rename_namespace("ADO") rename("EOF", "EndOfFile")<br />
#import "c:\Program Files\Common Files\system\ado\msadox.dll" no_namespace
If I remember correctly you need to specify a namespace for ADO.
Michael
Programming is great. First they pay you to introduce bugs into software. Then they pay you to remove them again.
|
|
|
|
|
All I did was replace my
#import "C:\\Program Files\\Common Files\\System\\ADO\\msado25.tlb" \
no_namespace \
rename( "EOF", "adoEOF" )
with your
rename_namespace "ADO" and I got 234 compile errors! I hadnt even breathed ADOX yet!!
Now what?
thanks,
ns
|
|
|
|