WideStudio/MWT Class Reference

WideStudio/MWT Home
Up to


Class Name

WSCgrid

Specification of methods



getCellGeometry Function Description

Form
long getCellGeometry(WSCulong cx,WSCulong cy, short* x,short* y, WSCushort* w,WSCushort* h)
Function
Obtain a specified cell size
Description
Obtain cell size specified by row:cx and line:cy in a grid instance's coordinate system
Parameters
(in)long cx Cell horizontal position
(in)long cy Cell vertical position
(out)short* x X coordinate
(out)short* y Y coordinate
(out)WSCshort* w Width
(out)WSCshort* h Height
Return value
WS_NO_ERR= Normal, otherwise error.
Notice
Samples
#include <WSCgrid.h>
void sample_proc(WSCbase* object){
  WSCgrid* grid = (WSCgrid*)object->cast("WSCgrid");
  if (grid == NULL){
    return;
  }
  //Obtain the number of cells and display each cell size
  short xcells = grid->getHColumns();
  short ycells = grid->getVColumns();
  short cx,cy;
  for(cx=0; cx < xcells; cx++){
    for(cy=0; cy < ycells; cy++){
      short x,y;
      WSCushort w,h;
      //Obtain size
      grid->getCellGeometry(cx,cy,&x,&y,&w,&h);
      //Obtain a value
      WSCvariant val = grid->getItem(cx,cy);
      printf("cell(%d,%d):  x,y=%d,%d w,h=%d,%d val=%s\n",cx,cy,x,y,w,h,
                                                         (char*)val);
    }
  }
}



getHColumns Function Description

Form
long getHColumns();
Function
Obtain the number of cells in the horizontal direction
Description
Parameters
None.
Return value
The number of cells
Notice
Samples
Refer to getCellGeometry()



getVColumns Function Description

Form
long getVColumns();
Function
Obtain the number of cells in the vertical direction
Description
Parameters
None.
Return value
The number of cells
Notice
Samples
Refer to getCellGeometry()



setItem Function Description

Form
long setItem(WSCulong cx,WSCulong,cy,WSCvariant val);
Function
Set a value in a specified cell
Description
Specify a WSCvariant type value in a cell specified by row:cx, line:cy
Parameters
(in)long cx Cell horizontal position
(in)long cy Cell vertical position
(in)WSCvariant val Value
Return value
WS_NO_ERR= Normal, otherwise error.
Notice
Samples
Refer to getCellGeometry()



setCellForeColor Function Description

Form
long setCellForeColor(WSCulong cx,WSCulong cy,short color);
Function
Set the foreground color in a specified cell
Description
Specify the foreground color by the color number at a cell specified by row:cx, line:cy
Parameters
(in)long cx Cell horizontal position
(in)long cy Cell vertical position
(in)short color Color number
Return value
WS_NO_ERR= Normal, otherwise error.
Samples
  //Obtain the black color number and set it to the foreground color of an upper left cell
  short cno = WSGIappColorSet()->getColorNo("#000000");
  newgrid_000->setCellForeColor(0,0,cno);
Notice



setCellForeColor Function Description

Form
long setCellForeColor(WSCulong cx,WSCulong cy,char* cname);
Function
Set foreground color in a specified cell
Description
Specify foreground color by a color name at a cell specified by row:cx, line:cy
Parameters
(in)long cx Cell horizontal position
(in)long cy Cell vertical position
(in)char* cname Color name

Color names are specified by the following format
#RRGGBB
RR: Specify the red brightness in hexadecimal numbers (00-ff)
GG: Specify the green brightness in hexadecimal numbers (00-ff)
BB: Specify the blue brightness in hexadecimal numbers (00-ff)
Return value
WS_NO_ERR= Normal, otherwise error.
Notice
Samples
  //Set black foreground color in an upper left cell
  newgrid_000->setCellForeColor(0,0,"#ffffff");



setCellBackColor Function Description

Form
long setCellBackColor(WSCulong cx,WSCulong cy,short color);
Function
Set background color in a specified cell
Description
Specify background color by the color number at a cell specified by row:cx, line:cy
Parameters
(in)long cx Cell horizontal position
(in)long cy Cell vertical position
(in)short color Color number
Return value
WS_NO_ERR= Normal, otherwise error.
Notice
Samples
  //Obtain the white color number and set it to the background color of an upper left cell
  short cno = WSGIappColorSet()->getColorNo("#ffffff");
  newgrid_000->setCellBackColor(0,0,cno);



setCellBackColor Function Description

Form
long setCellBackColor(WSCulong cx,WSCulong cy,char* cname);
Function
Set the foreground color in a specified cell
Description
Specify the foreground color by a color name at a cell specified by row:cx, line:cy
Parameters
(in)long cx Cell horizontal position
(in)long cy Cell vertical position
(in)char* cname Color name

Color names are specified by the following format
#RRGGBB
RR: Specify the red brightness in hexadecimal numbers (00-ff)
GG: Specify the green brightness in hexadecimal numbers (00-ff)
BB: Specify the blue brightness in hexadecimal numbers (00-ff)
Return value
WS_NO_ERR= Normal, otherwise error.
Notice
  //Set white background color in an upper left cell
  newgrid_000->setCellBackColor(0,0,"#000000");



getItemAlignment Function Description

Form
long getItemAlignment(WSCulong cx,WSCulong cy);
Function
Obtain specified cell alignment
Description
Obtain cell alignment of specifed row:cx, line:cy
Parameters
(in)long cx Cell horizontal position
(in)long cy Cell vertical position
Return value
Alignment
The following alignments are supported
Value Meaning
WS_LEFT Left
WS_RIGHT Right
WS_CENTER Center
WS_TOP Top
WS_BOTTOM Bottom
WS_LEFT_TOP Upper left
WS_LEFT_BOTTOM Lower left
WS_RIGHT_TOP Upper right
WS_RIGHT_BOTTOM Lower right

Notice
Samples
  //Obtain upper left cell alignment
  WSCuchar alignment = newgrid_000->getItemAlignment(0,0);



getItem Function Description

Form
WSCvariant getItem(WSCulong cx,WSCulong cy);
Function
Obtain a specified cell value
Description
Obtain a specified cell value specified by row:cx, line:cy
Parameters
(in)long cx Cell horizontal position
(in)long cy Cell vertical position
Return value
A cell value
Samples
Refer to getCellGeometry()
Notice


Document Release 3.90

For use with WideStudio/MWT Release 3.90, Summer 2005


WideStudio/MWT Home | Up to

Copyright(C) WideStudio/MWT Development Team, 1999-2005 Last modified: June 25, 2005