Register | Login
Views: 19364387
Main | Memberlist | Active users | ACS | Commons | Calendar | Online users
Ranks | FAQ | Color Chart | Photo album | IRC Chat
11-02-05 12:59 PM
0 user currently in Programming. | 3 guests
Acmlm's Board - I2 Archive - Programming - How to use multi-column list boxes? | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
User Post
HyperLamer
<||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people

Sesshomaru
Tamaranian

Level: 118

Posts: 4728/8210
EXP: 18171887
For next: 211027

Since: 03-15-04
From: Canada, w00t!
LOL FAD

Since last post: 2 hours
Last activity: 2 hours
Posted on 06-02-05 08:59 AM Link | Quote
I've figured out the basics of how to use a list box in C, but nowhere on Google or MSDN can I find info on how to use a multi-column box. The only functions I see listed are for setting the column width. So... Eh, you can guess what I'm going to ask.


(edited by HyperHacker on 06-01-05 03:59 PM)
Lenophis

Super Koopa
Level: 44

Posts: 475/830
EXP: 584360
For next: 26925

Since: 03-15-04
From: Duluth, MN

Since last post: 4 hours
Last activity: 3 hours
Posted on 06-02-05 10:33 AM Link | Quote
Hmmm, after looking through the "Insert..." list of MSDN, this is what I came up with:

LRESULT InsertGroup(
int index,
PLVGROUP pgrp
);

Parameters
index
The index of the item where the group is to be inserted.
pgrp
A pointer to an LVGROUP structure containing the group to be added.
Return Value
Returns the index of the item that the group was added to, or -1 if the operation failed.

LVGROUP Structure

--------------------------------------------------------------------------------

Used to set and retrieve groups.

Syntax

typedef struct LVGROUP {
UINT cbSize;
UINT mask;
LPWSTR pszHeader;
int cchHeader;
LPWSTR pszFooter;
int cchFooter;
int iGroupId;
UINT stateMask;
UINT state;
UINT uAlign;
} LVGROUP, *PLVGROUP;
Members

cbSize
Size of an LVGROUP structure.
mask
Specifies which members of the structure are valid input. It can have one or more of the following values.
LVGF_ALIGN
uAlign member is valid.
LVGF_FOOTER
Reserved.
LVGF_GROUPID
iGroupId member is valid.
LVGF_HEADER
pszHeader and cchHeader members are valid.
LVGF_NONE
No other items are valid.
LVGF_STATE
Reserved.
pszHeader
Pointer to a string that contains the header.
cchHeader
Number of characters in the string that specifies the header.
pszFooter
Pointer to a string that contains the footer.
cchFooter
Number of characters in the string that specifies the footer.
iGroupId
Identifier (ID) of the group.
stateMask
Reserved; must be zero.
state
Flag that can have the following value.
LVGS_NORMAL
Groups are expanded, the group name is displayed, and all items in the group are displayed.
uAlign
Indicates the alignment of the header or footer text for the group. It can have one or more of the following values. Use one of the header flags. Footer flags are optional. Windows XP: Footer flags are reserved.
LVGA_FOOTER_CENTER
Reserved.
LVGA_FOOTER_LEFT
Reserved.
LVGA_FOOTER_RIGHT
Reserved.
LVGA_HEADER_CENTER
Header text is centered horizontally in the window.
LVGA_HEADER_LEFT
Header text is aligned at the left of the window.
LVGA_HEADER_RIGHT
Header text is aligned at the right of the window.


If it isn't this, then I dunno. Hope it helps (a longshot is better than no shot at all! :p)
HyperLamer
<||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people

Sesshomaru
Tamaranian

Level: 118

Posts: 4729/8210
EXP: 18171887
For next: 211027

Since: 03-15-04
From: Canada, w00t!
LOL FAD

Since last post: 2 hours
Last activity: 2 hours
Posted on 06-02-05 10:37 PM Link | Quote
Hm, that seems to be related more to a list view than a list box. (I'd like to use a list view, but I can't find one in my dialog editor. )

If it's really necessary, I could fake the columns with tabs, but I can't get tabs to show up either. It just ignores them. (I can do it no problem in VB though, so it should be easy enough.)


(edited by HyperHacker on 06-02-05 05:39 AM)
(edited by HyperHacker on 06-02-05 05:39 AM)
sloat

Level: 16

Posts: 51/85
EXP: 18044
For next: 2212

Since: 05-21-04
From: South Central Delaware

Since last post: 19 days
Last activity: 5 hours
Posted on 06-02-05 11:52 PM Link | Quote
When you create the listbox specify the LBS_MULTICOLUMN style. Or however you do it with your dialog editor. Be warned that a multicolumn listbox is not the same as a multicolumn listview. I'm pretty sure that it just fills up the list according to the height of the window, then moves to the next column and scrolls horizontally.

For tabs, you should specify LBS_USETABSTOPS. Check the LB_SETTABSTOPS message for more info.

Or if that doesn't turn out how you want, you can always have the listbox owner-drawn. You can use TabbedTextOut to draw the text.

Still, if you want to have true sub-items, ListView is better.
HyperLamer
<||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people

Sesshomaru
Tamaranian

Level: 118

Posts: 4742/8210
EXP: 18171887
For next: 211027

Since: 03-15-04
From: Canada, w00t!
LOL FAD

Since last post: 2 hours
Last activity: 2 hours
Posted on 06-04-05 01:14 AM Link | Quote
I got the LBS_MULTICOLUMN part. As for tab stops, isn't that just for whether you can focus it by pressing Tab?

Any idea how I could manually add a listview in the code? There must be like a window class or something I would use.


[edit] Heh, you were right, tab stops does refer to the tab character. I managed to get the list view working anyway though. Don't suppose anyone knows how to make it highlight the entire row instead of just the left-most item? Or how to enable column rearranging?

Also, how can I get some sort of notice when a window is created or destroyed? My program is monitoring the status of several windows of a certain type (reading things from their controls and such). Currently it does this by just going through all the windows and picking out the ones it needs to read every second or so, but this of course takes a lot of CPU power. Keeping an internal list of them isn't too difficult except that it needs some way to know when a new one appears. I tried using a shell hook but it only told me when my window had focus; it says something about being restricted to libraries.


(edited by HyperHacker on 06-03-05 05:22 PM)
(edited by HyperHacker on 06-03-05 08:14 PM)
sloat

Level: 16

Posts: 52/85
EXP: 18044
For next: 2212

Since: 05-21-04
From: South Central Delaware

Since last post: 19 days
Last activity: 5 hours
Posted on 06-04-05 11:02 AM Link | Quote
LVS_EX_FULLROWSELECT
use the ListView_SetExtendedListViewStyle macro. There is usually a macro for each listview message. It's much easier to deal with these than having to type out long message names and cast the params.
HyperLamer
<||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people

Sesshomaru
Tamaranian

Level: 118

Posts: 4775/8210
EXP: 18171887
For next: 211027

Since: 03-15-04
From: Canada, w00t!
LOL FAD

Since last post: 2 hours
Last activity: 2 hours
Posted on 06-04-05 02:08 PM Link | Quote
Hm, LVS_EX_FULLROWSELECT isn't defined. [Edit: Fixed it... flickery though ] (Also, I edited the other post.)

Is there some way to trap file access? Like say a program tries to open file.txt, my program can make it open differentfile.txt and think it's file.txt? (Even when file.txt doesn't actually exist.) I know I've seen it done with custom device drivers, but hopefully I won't have to resort to anything that complicated.

Also, how can I create a layered child window, or one where a certain colour is transparent? WS_EX_LAYERED can't be applied to child windows, and I need all areas of the window that I haven't drawn on yet to be invisible so you can see what's under it (and if possible click the stuff under it even).


(edited by HyperHacker on 06-03-05 10:50 PM)
(edited by HyperHacker on 06-03-05 10:56 PM)
(edited by HyperHacker on 06-04-05 03:47 PM)
sloat

Level: 16

Posts: 53/85
EXP: 18044
For next: 2212

Since: 05-21-04
From: South Central Delaware

Since last post: 19 days
Last activity: 5 hours
Posted on 06-06-05 02:04 AM Link | Quote
There's a way to watch for file changes in a directory.
FindFirstChangeNotification

It's not exactly what you meant. To watch for files being opened and to make another process open a different file would require a driver. Good luck with that. The DDK is no longer free...well I can't remember if it was free before, but I know it wasn't $199 before. Windows DDK.


Oh, and to have a translucent child window (I think that's what you're asking...translucent over the background of the parent window?), you can either fight with the control by subclassing it and repainting it yourself, or write your own custom control. They might be about equal in frustration, depending on what you're making.


(edited by sloat on 06-05-05 09:09 AM)
HyperLamer
<||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people

Sesshomaru
Tamaranian

Level: 118

Posts: 4801/8210
EXP: 18171887
For next: 211027

Since: 03-15-04
From: Canada, w00t!
LOL FAD

Since last post: 2 hours
Last activity: 2 hours
Posted on 06-06-05 03:29 AM Link | Quote
Damn, I was hoping to make something to do the equivilant of this. Guess it's hardlinks for me then.

Also I'm talking about transparency, not translucency, as defined by the API... Translucency is like alpha-blending (you can see the window, but also see through it) whereas transparency is as if there were nothing there at all. I can easily make any window translucent but that doesn't help much. WS_EX_LAYERED does exactly what I want (any pixels of a certain colour are just not drawn at all) but I can't use it.

[edit] Illustration of what I mean:

The left window is translucent. The right window (thanks to MSPaint) has a square in each corner transparent.


(edited by HyperHacker on 06-05-05 10:39 AM)
sloat

Level: 16

Posts: 54/85
EXP: 18044
For next: 2212

Since: 05-21-04
From: South Central Delaware

Since last post: 19 days
Last activity: 5 hours
Posted on 06-06-05 08:10 AM Link | Quote
Oh...guess I miss understood. Sorry about that.
You can make parts of a window completely transparent by modifying its window region. Basically, you create a region shape and either use that shape as the new region, or combine it with the current region to give a "hole" effect.

It's kind of hard to explain. The best way to figure it out is to experiment. I'm not sure how well this will work on child windows, though. I've never tried it. I dunno if a child window has its own window region or if it shares with the parent.

SetWindowRgn, GetWindowRgn, CombineRgn and CreateRectRgn should be your starting points. I can probably help if you run in to trouble.
HyperLamer
<||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people

Sesshomaru
Tamaranian

Level: 118

Posts: 4810/8210
EXP: 18171887
For next: 211027

Since: 03-15-04
From: Canada, w00t!
LOL FAD

Since last post: 2 hours
Last activity: 2 hours
Posted on 06-06-05 10:18 AM Link | Quote
Hm, that might do... It'll probably be difficult to get the effect I was hoping for though. I want to draw on the window, and not have anything but what I've drawn show up. (This may be text, graphics, etc.)

Also, two other things I need to do:

1) Convert various images (JPGs, PNGs, etc) to bitmaps.
2) Change the desktop wallpaper tiling mode (center, tile, stretch).

I can change the wallpaper but it won't do anything besides bitmaps (Explorer's Display Settings just automatically converts the image and stores it somewhere), and can't find any way to change the tiling mode.


(edited by HyperHacker on 06-06-05 03:25 PM)
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
Acmlm's Board - I2 Archive - Programming - How to use multi-column list boxes? | |


ABII


AcmlmBoard vl.ol (11-01-05)
© 2000-2005 Acmlm, Emuz, et al



Page rendered in 0.007 seconds.