|
Is there any easy way to determine the number of columns a CListCtrl has?
I have a base class function that iterates through derived class list controls, saving all the data. I can't see anything in the CListCtrl class that would indicate how many columns are being used in the control!
Any ideas?
|
|
|
|
|
If the control is in report mode, you can get the header control and call GetItemCount:
int a_iColumns = GetHeaderCtrl()->GetItemCount();
Chris Richardson
C/C++ Include Finder[^]
|
|
|
|
|
|
Thanks to everyone!
I knew it would be simple, I just couldn't find it. I opted for a quick and "dirty" approach of keeping track of it with an array of ints (yuk). I'll switch to GetItemCount now.
|
|
|
|
|
You can retrive it from the associated header control.
e.g.
CListCtrl m_lstItems;
int nNumCols = m_lstItems.GetHeaderCtrl()->GetItemCount();
Dave
|
|
|
|
|
Maybe i should refresh more often...
Dave
|
|
|
|
|
I'm set up to load every page... Of course DSL makes that an easy choice!
|
|
|
|
|
All I need are two buttons that have an up arrow and a down arrow. I looked at CBitmapButton class but I dont need it to look different when pressed etc. If I could just draw on a regular button - thats all I need.
So I am looking at the spinbutton ctrl. I dont need the autobuddy stuff, just access to a function that fires if I press the up arrrow, and a different one for the down arrow of the spinbutton ctrl.
If neither of these is suitable, I can just write the text "Up" and "down" on my regular old buttons ,,,,it just wont look so cool........
Suggestions?
Appreciate your help,
ns
|
|
|
|
|
Well, the spin button control sends a WM_VSCROLL message when you click on the arrows (if it's vertically aligned). Also the MSDN says it sends a UDN_DELTAPOS message, but I've never used that before. So, hook up a handler for WM_VSCROLLL and look for SB_LINEUP and SB_LINEDOWN or SB_PAGEUP and SB_PAGEDOWN (can't remember which ones are sent by the spin button).
Chris Richardson
C/C++ Include Finder[^]
|
|
|
|
|
|
Hi all,
This is just a shot in the dark but is there someone out there who has used Crystal Reports 9 successfully with unmanaged visual c++ code, preferably in a MFC application? The examples on crystal decisions website are too terse to understand and there seems to be no sample files that don't need managed code.
Cheers,
Clint
|
|
|
|
|
I use a CEdit Control among other controls like a CListBox and a CCombox (but in DropDownList mode) in a CView window. Everything goes well except that when i click on the CEdit Control I don't succeed in obtaining the focus on it. I succeed in obtaining it only with a double click, and there are some visual artefacts when I click on the other controls (the appearance of the Edit stays selected). And if I active an other application or if I open a Dialog Box when the document frame is activated again, the simple click is working quite well. And when it begins to work it work until i exit from the application. Is somebody has an idea about that?
|
|
|
|
|
What gains focus if not the edit control? Check if the view is set to focus another object upon single mouseclick.
Kuphryn
|
|
|
|
|
It seems that the focus stays on the control which had the focus before the click. Another strange thing about the CEdit Control if I strike TAB we do not go to the next control and we have a bip.
I am perfectly sure that the focus is not set to another object on sigle mouseclick
|
|
|
|
|
Hi everybody
I have to show a list of values in a list in different columns.
There is a simple way to show them right aligned?
Ex
YEAR PRICE BOYS GIRLS E.T.
1992/1993 200 5 4 7
1993/1994 3.000 27 45 126
Thanks in advance.
Best Regards
Dr. Pi
|
|
|
|
|
Sorry the example looked good in the editor but not in the final message
Dr. Pi
|
|
|
|
|
If you want the columns right aligned, specify LVCFMT_RIGHT for the nFormat parameter of the InsertColumn function. This will work nicely for all columns except the first one. For some reason, you can't right align the first column I don't think.
YourListControl.InsertColumn( 0, _T("Column0"), LVCFMT_RIGHT, 100 );
Chris Richardson
C/C++ Include Finder[^]
|
|
|
|
|
You can, but you have to set the style to right align after you have created the column.
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
I'm trying to make a Winamp plugin (Win32 DLL) and a text-only one will compile just fine. Whenever I add any resource script to it, however, I get this error:
Linking...<br />
.\Debug\script1.res : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt<br />
Error executing link.exe.<br />
|
|
|
|
|
I'm trying to find out if there's a way to leverage the "Searching" progress indicator in XP. When you search for files in Exporer displayed the Luna interface, you get a little wrap-around progress indicator with 3 gradient filled boxes. It basically uses a WM_TIMER message to update the box positions.
Spy++ tells me that this the window class is SA_Progress, but a Google search gives me only 1 newsgroup comment. I know it's trivial to implement, but I'd like to conform to the active theme colors and shapes, and the documentation for GetThemeColor isn't exactly definitive (or existant). Any suggestions? Thanks.
|
|
|
|
|
|
Check out CListCtrl::GetTopIndex and CListCtrl::GetCountPerPage. You should be able to calculate the last visible item this way. Cheers.
|
|
|
|
|
|
Hi,
I'm trying to turn a bitmap on and off (if it were a CWnd, I would use CWnd::ShowWindow(SH_HIDE) ) How can I do this?
Basically, here is what I will have:
I will have "layers" of bitmaps in one rectangular area. I am a little familiar with device contexts and will try to associate each layer with it's own device context.
When I want to Show/Hide a layer, I will operate on that specific device context.
Each layer will have a unique color used -- there is only one color used in drawing on that layer.
Are there any suggestions on how I can programmatically turn on/off a specific layer?
Thank you very much!
Johnny
|
|
|
|
|