How to know the size of row label or col label?

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
shawnee
Experienced Solver
Experienced Solver
Posts: 78
Joined: Tue Jan 16, 2018 1:05 am

How to know the size of row label or col label?

Post by shawnee »

Hi,

About cell, we can use CellToRect(int row, int col), but what about row label or col label?
Thanks!
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: How to know the size of row label or col label?

Post by doublemax »

I assume you're talking about wxGrid.

Code: Select all

GetColLabelSize () const 
GetColSize (int col) const 

GetRowLabelSize () const 
GetRowSize (int row) const 
Use the source, Luke!
shawnee
Experienced Solver
Experienced Solver
Posts: 78
Joined: Tue Jan 16, 2018 1:05 am

Re: How to know the size of row label or col label?

Post by shawnee »

doublemax wrote: Fri Apr 12, 2019 8:43 am I assume you're talking about wxGrid.

Code: Select all

GetColLabelSize () const 
GetColSize (int col) const 

GetRowLabelSize () const 
GetRowSize (int row) const 
If I want to know coordinates of one of row/col label, is there this kind of member function?
CellToRect can get position in logical coordinates of cell.
Thanks!
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: How to know the size of row label or col label?

Post by doublemax »

shawnee wrote: Fri Apr 12, 2019 11:52 am If I want to know coordinates of one of row/col label, is there this kind of member function?
CellToRect can get position in logical coordinates of cell.
I don't think so. What for do you need this information?
Use the source, Luke!
shawnee
Experienced Solver
Experienced Solver
Posts: 78
Joined: Tue Jan 16, 2018 1:05 am

Re: How to know the size of row label or col label?

Post by shawnee »

doublemax wrote: Fri Apr 12, 2019 12:16 pm
shawnee wrote: Fri Apr 12, 2019 11:52 am If I want to know coordinates of one of row/col label, is there this kind of member function?
CellToRect can get position in logical coordinates of cell.
I don't think so. What for do you need this information?
It's for a very special purpose. I want to know the position of row/col label, then stick a widget to overlap it.

for example, to overlap one of col label:

Code: Select all

        const int c_GridLineSize = 1;
        
        int cell_width = GetColWidth(col);
        int colheader_height = GetColLabelSize();

        int skippedWidth = 0;
        for (int i = 0; i < col; i++) {
            skippedWidth += GetColWidth(i);
        }
        
        win->Move(skippedWidth+c_GridLineSize , c_GridLineSize);
        win->SetSize(cell_width-2*c_GridLineSize,colheader_height-2*c_GridLineSize);
it's almost ok, but the grid line between two col labels is always overlapped, can not be shown. I don't know why, suppose the size of win should be right.

Thanks!
shawnee
Experienced Solver
Experienced Solver
Posts: 78
Joined: Tue Jan 16, 2018 1:05 am

Re: How to know the size of row label or col label?

Post by shawnee »

the parent of win is GetGridColLabelWindow()
shawnee
Experienced Solver
Experienced Solver
Posts: 78
Joined: Tue Jan 16, 2018 1:05 am

Re: How to know the size of row label or col label?

Post by shawnee »

Another question, no way to drag move row label?
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7458
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: How to know the size of row label or col label?

Post by ONEEYEMAN »

Hi,
shawnee wrote: Fri Apr 12, 2019 2:23 pm
doublemax wrote: Fri Apr 12, 2019 12:16 pm
shawnee wrote: Fri Apr 12, 2019 11:52 am If I want to know coordinates of one of row/col label, is there this kind of member function?
CellToRect can get position in logical coordinates of cell.
I don't think so. What for do you need this information?
It's for a very special purpose. I want to know the position of row/col label, then stick a widget to overlap it.

for example, to overlap one of col label:

Code: Select all

        const int c_GridLineSize = 1;
        
        int cell_width = GetColWidth(col);
        int colheader_height = GetColLabelSize();

        int skippedWidth = 0;
        for (int i = 0; i < col; i++) {
            skippedWidth += GetColWidth(i);
        }
        
        win->Move(skippedWidth+c_GridLineSize , c_GridLineSize);
        win->SetSize(cell_width-2*c_GridLineSize,colheader_height-2*c_GridLineSize);
it's almost ok, but the grid line between two col labels is always overlapped, can not be shown. I don't know why, suppose the size of win should be right.

Thanks!
Why?
I believe there is a renderer specifically for row/col label...

Thank you.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7458
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: How to know the size of row label or col label?

Post by ONEEYEMAN »

Hi,
shawnee wrote: Fri Apr 12, 2019 2:25 pm Another question, no way to drag move row label?
Correct.
What is the purpose?

Thank you.
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: How to know the size of row label or col label?

Post by doublemax »

shawnee wrote: Fri Apr 12, 2019 2:25 pm Another question, no way to drag move row label?
No. That's only supported for columns.
Use the source, Luke!
Post Reply