Page 1 of 1

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

Posted: Fri Apr 12, 2019 8:37 am
by shawnee
Hi,

About cell, we can use CellToRect(int row, int col), but what about row label or col label?
Thanks!

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

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

Code: Select all

GetColLabelSize () const 
GetColSize (int col) const 

GetRowLabelSize () const 
GetRowSize (int row) const 

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

Posted: Fri Apr 12, 2019 11:52 am
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!

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

Posted: Fri Apr 12, 2019 12:16 pm
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?

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

Posted: Fri Apr 12, 2019 2:23 pm
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!

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

Posted: Fri Apr 12, 2019 2:24 pm
by shawnee
the parent of win is GetGridColLabelWindow()

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

Posted: Fri Apr 12, 2019 2:25 pm
by shawnee
Another question, no way to drag move row label?

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

Posted: Fri Apr 12, 2019 2:30 pm
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.

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

Posted: Fri Apr 12, 2019 2:31 pm
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.

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

Posted: Fri Apr 12, 2019 4:13 pm
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.