I tried to write a program using my GUI library and your powergrid control :)
first, it didn't display anything; after debugging a lot, I found that I actually needed to put some non-zero values in the rect structure (your demo worked fine because of the WM_SIZE handler)
then I noticed that it didn't respond to the keyboard (with just a few exceptions); after debugging even more, I found the essential difference: the message loop in my library contains this:
if(!IsDialogMessage(GetActiveWindow(), &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
I use IsDialogMessage mainly to handle the TAB key to switch between controls in the window, but it seems that it doesn't get along well with your control, can you please look into it?
while looking around, I noticed that you already have some code to resize columns with the mouse (SGO_USERSIZE), but it doesn't work well
I suggest that you replace (in msghandler.cpp) the lines:
if(m_colWidths[m_sizingCol] > 10)
m_colWidths[m_sizingCol]--;
(is that dummy code?)
with something like this:
if(m_colWidths[m_sizingCol]>w+2)
{
m_colWidths[m_sizingCol]-=w;
m_sizingLeft-=w;
}
(I tested it, looks ok)
finally, do you use any instant messanger? I'd like to be able to talk to you that way
here's what I use: www14.brinkster.com/aditsu/contacteng.asp
Adrian
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
oh, I found an easy solution for the keyboard problem:
case WM_GETDLGCODE:
return DLGC_WANTALLKEYS;
break;
however, that may disable the TAB functionality when the grid has focus; I'll have to test it later, right now I don't have other controls in the window :p
Adrian
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
> I started working on the user sizing of the columns a while ago but never went very far with it yet.
well, try my fix and see if you need anything else :)
AFAICT, you did almost all the work, except the very last step
> I do hang out on IRC though.
which channel?
> I'll see about installing some kind of IM too.
yahoo messenger is one of the best
> how does my overall coding style look?
well, I can see that you put a lot of effort into the project, and wrote some good stuff, with comments too :)
but I also noticed some little "horrors" such as the GetCellColor function (oh and btw, why do you use indexed colors? and why do you keep the color information inside the cell string?)
anyway, I just saw a few parts of the code, I didn't study it in detail
Adrian
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
> which channel?
Darkmyst.net #tolkien as Sideshow Bob
Yeah, the GetCellColor function was one of those 'brute force, make it work' sort of things. The color and attribute functions need work still, I just wanted to get something working.
I wanted to be able to save the color settings with the string when I impliment a save to file function. Figured I could add a couple of extra characters to store the colors and attributes.
I suppose I used indexed colors so I could use one SetColor function to set any of them. Seems to work ok, open to suggestions though..
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I tried to write a program using my GUI library and your powergrid control :)
first, it didn't display anything; after debugging a lot, I found that I actually needed to put some non-zero values in the rect structure (your demo worked fine because of the WM_SIZE handler)
then I noticed that it didn't respond to the keyboard (with just a few exceptions); after debugging even more, I found the essential difference: the message loop in my library contains this:
if(!IsDialogMessage(GetActiveWindow(), &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
I use IsDialogMessage mainly to handle the TAB key to switch between controls in the window, but it seems that it doesn't get along well with your control, can you please look into it?
while looking around, I noticed that you already have some code to resize columns with the mouse (SGO_USERSIZE), but it doesn't work well
I suggest that you replace (in msghandler.cpp) the lines:
if(m_colWidths[m_sizingCol] > 10)
m_colWidths[m_sizingCol]--;
(is that dummy code?)
with something like this:
if(m_colWidths[m_sizingCol]>w+2)
{
m_colWidths[m_sizingCol]-=w;
m_sizingLeft-=w;
}
(I tested it, looks ok)
finally, do you use any instant messanger? I'd like to be able to talk to you that way
here's what I use: www14.brinkster.com/aditsu/contacteng.asp
Adrian
oh, I found an easy solution for the keyboard problem:
case WM_GETDLGCODE:
return DLGC_WANTALLKEYS;
break;
however, that may disable the TAB functionality when the grid has focus; I'll have to test it later, right now I don't have other controls in the window :p
Adrian
I'll look into those things.
I started working on the user sizing of the columns a while ago but never went very far with it yet.
I don't use any instant messaging, I do hang out on IRC though. I'll see about installing some kind of IM too.
Out of curiosity, how does my overall coding style look? I have no idea whether I'm writing crap or not... lol.
thanx again
b_a
> I started working on the user sizing of the columns a while ago but never went very far with it yet.
well, try my fix and see if you need anything else :)
AFAICT, you did almost all the work, except the very last step
> I do hang out on IRC though.
which channel?
> I'll see about installing some kind of IM too.
yahoo messenger is one of the best
> how does my overall coding style look?
well, I can see that you put a lot of effort into the project, and wrote some good stuff, with comments too :)
but I also noticed some little "horrors" such as the GetCellColor function (oh and btw, why do you use indexed colors? and why do you keep the color information inside the cell string?)
anyway, I just saw a few parts of the code, I didn't study it in detail
Adrian
> which channel?
Darkmyst.net #tolkien as Sideshow Bob
Yeah, the GetCellColor function was one of those 'brute force, make it work' sort of things. The color and attribute functions need work still, I just wanted to get something working.
I wanted to be able to save the color settings with the string when I impliment a save to file function. Figured I could add a couple of extra characters to store the colors and attributes.
I suppose I used indexed colors so I could use one SetColor function to set any of them. Seems to work ok, open to suggestions though..