Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[C++]Multi-Column List Box (or an alternative?)

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Sat Jul 12, 2008 12:07 pm    Post subject: [C++]Multi-Column List Box (or an alternative?) Reply with quote

How do I add columns, like in a GridBox control, so it'll look like Cheat Engine's Cheat Table, there's "Freeze" column, "Description" column, etc...

Oh, and:
msdn wrote:
List boxes with the LBS_MULTICOLUMN style cannot be vertically scrolled. The list box ignores any WM_VSCROLL messages it receives.

Is this some kind of joke? Confused
Or is there an alternative for multicolumn list box?
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Sat Jul 12, 2008 12:12 pm    Post subject: Reply with quote

Headers
_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Sat Jul 12, 2008 12:15 pm    Post subject: Reply with quote

Thanks for the quick answer. Razz

But what about scrolling?
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Sat Jul 12, 2008 12:26 pm    Post subject: Reply with quote

Lol. Just set WM_HSCROLL AND WM_VSCROLL (if you have to). I don't think you have to set LBS_MULTICOLUMN for headers. I think the thing with LBS_MULTICOLUMN was that it would put it in more than one column, but it wouldn't be like headers. So that's why there wasn't WM_VSCROLL.
_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Sat Jul 12, 2008 12:51 pm    Post subject: Reply with quote

Ok, I understand how to add headers, but my ListBox is still one column...:


There's also another item below the header and when I click it, the header goes to the back.

The header isn't above the list box, its right on it.
Back to top
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Sat Jul 12, 2008 1:42 pm    Post subject: Reply with quote

Don't tab stops affect multi column behavior?
_________________
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Sat Jul 12, 2008 2:01 pm    Post subject: Reply with quote

I'm not using LBS_MULTICOLUMN.
When I do, the item doesn't doesn't move with the header, how do I add an item for each column?
When I add an item, it belongs to the ListBox, not to the column.
I couldn't find anything on MSDN... Confused
Back to top
View user's profile Send private message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Sat Jul 12, 2008 2:06 pm    Post subject: Reply with quote

why not add commctrl.h and use the ListView control instead of the ListBox.

from there its all

LVCOLUMN struct
ListView_InsertColumn macro

LVITEM struct
ListView_InsertItem macro
ListView_SetItem macro (for adding to columns other then the first one)

if u want the checkbox's you can use the extended style LVS_EX_CHECKBOXES with ListView_SetExtendedListViewStyle and the item of the first column will have a checkbox.

_________________
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Sat Jul 12, 2008 2:35 pm    Post subject: Reply with quote

Thanks. Razz

Umm, I'm trying to insert an item using "ListView_InsertItem", but its not working:
Code:
LVITEM i;
i.pszText = "....";
...
...
other parameters I don't know what they're for...
...
...
ListView_InsertItem(h,&i);


I couldn't find anything on google that explains what are all these parameters for or how to use the ListView control.

By the way:
Code:
SendMessage(h, LB_ADDSTRING, 0, (LPARAM)"...");

worked fine.
But I couldn't figure out how to add a column this way or another. Confused
Back to top
View user's profile Send private message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Sat Jul 12, 2008 2:42 pm    Post subject: Reply with quote

heres how u do it for columns.

Code:
LVCOLUMN LvCol;
memset( &LvCol, 0, sizeof(LVCOLUMN) );
LvCol.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
LvCol.cx   = 50;                               
LvCol.pszText =_T("Freeze");                   
SendMessage( hList, LVM_INSERTCOLUMN, 0, (LPARAM)&LvCol );


I used SendMessage, you can also use ListView_InsertColumn macro.

Heres items

Code:
LVITEM LvItem;
memset( &LvItem, 0, sizeof(LVITEM) );
LvItem.mask       = LVIF_TEXT;
LvItem.cchTextMax = 256;
LvItem.iItem      = 0;
LvItem.iSubItem   = 0;
LvItem.pszText    = _T("Item1");
SendMessage( hList, LVM_INSERTITEM, 0, (LPARAM)&LvItem );

LvItem.iSubItem = 1;
LvItem.pszText = _T("SubItem1")
SendMessage( hList, LVM_SETITEM, 0, (LPARAM)&LvItem );

_________________
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Sat Jul 12, 2008 2:58 pm    Post subject: Reply with quote

Edit: Uh, not working? Surprised

I think I'm missing some .dll or .lib files. Confused

Do I need to call InitCommonControls(Ex)?
Back to top
View user's profile Send private message
Cx
Master Cheater
Reputation: 0

Joined: 27 Jul 2007
Posts: 367

PostPosted: Sat Jul 12, 2008 3:21 pm    Post subject: Reply with quote

Yes.

Code:

#include <windows.h>
#include <commctrl.h>

    INITCOMMONCONTROLSEX    iccx;

    InitCtrlEx.dwSize = sizeof(INITCOMMONCONTROLSEX);
    InitCtrlEx.dwICC  = ICC_LISTVIEW_CLASSES; // and whatever else...
    if (InitCommonControlsEx(&InitCtrlEx))
    {
         // Create window(s).

_________________

armed with this small butterfly net
i will face the world alone
& never be lonely.
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Sat Jul 12, 2008 3:31 pm    Post subject: Reply with quote

I tried that, it said "unresolved externals" for both InitCommonContorls and InitCommonControlsEx, thats why I said I think I was missing some files.

I just checked, I'm missing commctrl.lib and commctrl.dll. (if those are the ones needed for InitCommonControls)
Back to top
View user's profile Send private message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Sat Jul 12, 2008 4:20 pm    Post subject: Reply with quote

Code:
#pragma comment ( lib, "comctl32.lib" )


and if you want visual style:

Code:
#pragma comment ( linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")

_________________
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Sat Jul 12, 2008 5:26 pm    Post subject: Reply with quote

Thanks, it fixed the error, but I still can't use ListView:

Sending LB_ADDSTRING message works, however this code:
Code:
LVCOLUMN LvCol;
memset( &LvCol, 0, sizeof(LVCOLUMN) );
LvCol.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
LvCol.cx   = 50;
LvCol.pszText = L"Item";
SendMessage( h, LVM_INSERTCOLUMN, 0, (LPARAM)&LvCol );

Doesn't do anything.

Is it just for me?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites