Groups > Superbase > Superbase 2 programming > Re: Screen Coordinates




Screen Coordinates

Screen Coordinates
Sat, 16 Feb 2008 09:39:32 -050
Is there a way of returning the display size in SB "Screen
Coordinates"?

Using Set Position for a window that should be as wide as possible, but of 
course monitors come in different sizes/resolutions.

What are these Screen Coordinates units? (If they're not pixels, what would 
they be?)

Thank you. 

Post Reply
Re: Screen Coordinates
Mon, 18 Feb 2008 09:43:11 -050
Thank you, Neil. Very much appreciated!

"Neil Robinson" <neil@simpol.com> wrote in message 
news:fpblkh$unp$1@ipx22096.ipxserver.de...
> John Ciccone wrote:
>> Is there a way of returning the display size in SB "Screen
Coordinates"?
>>
>> Using Set Position for a window that should be as wide as possible, but

>> of course monitors come in different sizes/resolutions.
>>
>> What are these Screen Coordinates units? (If they're not pixels, what 
>> would they be?)
>
> Using version 2, the only thing you can reasonably do is to call the OS 
> using GetDeviceCaps(). Here is a function that should work:
>
>  ' ********************************************************************
>  ' * GetDeviceCaps%%(indexval%%) -- Public
>  ' *
>  ' * Calls the Windows function of the same name to inquire about
>  ' * the capabilities of the current display driver.
>  ' *
>  ' *
>  ' * Device Parameters for GetDeviceCaps()
>  ' *    DRIVERVERSION = 0'  Device driver version
>  ' *    TECHNOLOGY = 2'  Device classification
>  ' *    HORZSIZE = 4'  Horizontal size in millimeters
>  ' *    VERTSIZE = 6'  Vertical size in millimeters
>  ' *    HORZRES = 8'  Horizontal width in pixels
>  ' *    VERTRES = 10'  Vertical width in pixels
>  ' *    BITSPIXEL = 12'  Number of bits per pixel
>  ' *    PLANES = 14'  Number of planes
>  ' *    NUMBRUSHES = 16'  Number of brushes the device has
>  ' *    NUMPENS = 18'  Number of pens the device has
>  ' *    NUMMARKERS = 20'  Number of markers the device has
>  ' *    NUMFONTS = 22'  Number of fonts the device has
>  ' *    NUMCOLORS = 24'  Number of colors the device supports
>  ' *    PDEVICESIZE = 26'  Size required for device descriptor
>  ' *    CURVECAPS = 28'  Curve capabilities
>  ' *    LINECAPS = 30'  Line capabilities
>  ' *    POLYGONALCAPS = 32'  Polygonal capabilities
>  ' *    TEXTCAPS = 34'  Text capabilities
>  ' *    CLIPCAPS = 36'  Clipping capabilities
>  ' *    RASTERCAPS = 38'  Bitblt capabilities
>  ' *    ASPECTX = 40'  Length of the X leg
>  ' *    ASPECTY = 42'  Length of the Y leg
>  ' *    ASPECTXY = 44'  Length of the hypotenuse
>  ' *
>  ' *    LOGPIXELSX = 88'  Logical pixels/inch in X
>  ' *    LOGPIXELSY = 90'  Logical pixels/inch in Y
>  ' *
>  ' *    SIZEPALETTE = 104'  Number of entries in physical palette
>  ' *    NUMRESERVED = 106'  Number of reserved entries in palette
>  ' *    COLORRES = 108'  Actual color resolution
>  ' *
>  ' *
>  ' *  Device Capability Masks:
>  ' *
>  ' *   Device Technologies
>  ' *    DT_PLOTTER = 0'  Vector plotter
>  ' *    DT_RASDISPLAY = 1'  Raster display
>  ' *    DT_RASPRINTER = 2'  Raster printer
>  ' *    DT_RASCAMERA = 3'  Raster camera
>  ' *    DT_CHARSTREAM = 4'  Character-stream, PLP
>  ' *    DT_METAFILE = 5'  Metafile, VDM
>  ' *    DT_DISPFILE = 6'  Display-file
>  ' *
>  ' *   Curve Capabilities
>  ' *    CC_NONE = 0'  Curves not supported
>  ' *    CC_CIRCLES = 1'  Can do circles
>  ' *    CC_PIE = 2'  Can do pie wedges
>  ' *    CC_CHORD = 4'  Can do chord arcs
>  ' *    CC_ELLIPSES = 8'  Can do ellipese
>  ' *    CC_WIDE = 16'  Can do wide lines
>  ' *    CC_STYLED = 32'  Can do styled lines
>  ' *    CC_WIDESTYLED = 64'  Can do wide styled lines
>  ' *    CC_INTERIORS = 128'  Can do interiors
>  ' *
>  ' *   Line Capabilities
>  ' *    LC_NONE = 0'  Lines not supported
>  ' *    LC_POLYLINE = 2'  Can do polylines
>  ' *    LC_MARKER = 4'  Can do markers
>  ' *    LC_POLYMARKER = 8'  Can do polymarkers
>  ' *    LC_WIDE = 16'  Can do wide lines
>  ' *    LC_STYLED = 32'  Can do styled lines
>  ' *    LC_WIDESTYLED = 64'  Can do wide styled lines
>  ' *    LC_INTERIORS = 128'  Can do interiors
>  ' *
>  ' *   Polygonal Capabilities
>  ' *    PC_NONE = 0'  Polygonals not supported
>  ' *    PC_POLYGON = 1'  Can do polygons
>  ' *    PC_RECTANGLE = 2'  Can do rectangles
>  ' *    PC_WINDPOLYGON = 4'  Can do winding polygons
>  ' *    PC_TRAPEZOID = 4'  Can do trapezoids
>  ' *    PC_SCANLINE = 8'  Can do scanlines
>  ' *    PC_WIDE = 16'  Can do wide borders
>  ' *    PC_STYLED = 32'  Can do styled borders
>  ' *    PC_WIDESTYLED = 64'  Can do wide styled borders
>  ' *    PC_INTERIORS = 128'  Can do interiors
>  ' *
>  ' *   Polygonal Capabilities
>  ' *    CP_NONE = 0'  No clipping of output
>  ' *    CP_RECTANGLE = 1'  Output clipped to rects
>  ' *
>  ' *   Text Capabilities
>  ' *    TC_OP_CHARACTER = &H1 '  Can do OutputPrecision CHARACTER
>  ' *    TC_OP_STROKE = &H2 '  Can do OutputPrecision STROKE
>  ' *    TC_CP_STROKE = &H4 '  Can do ClipPrecision STROKE
>  ' *    TC_CR_90 = &H8 '  Can do CharRotAbility 90
>  ' *    TC_CR_ANY = &H10 '  Can do CharRotAbility ANY
>  ' *    TC_SF_X_YINDEP = &H20 '  Can do ScaleFreedom X_YINDEPENDENT
>  ' *    TC_SA_DOUBLE = &H40 '  Can do ScaleAbility DOUBLE
>  ' *    TC_SA_INTEGER = &H80 '  Can do ScaleAbility INTEGER
>  ' *    TC_SA_CONTIN = &H100 '  Can do ScaleAbility CONTINUOUS
>  ' *    TC_EA_DOUBLE = &H200 '  Can do EmboldenAbility DOUBLE
>  ' *    TC_IA_ABLE = &H400 '  Can do ItalisizeAbility ABLE
>  ' *    TC_UA_ABLE = &H800 '  Can do UnderlineAbility ABLE
>  ' *    TC_SO_ABLE = &H1000 '  Can do StrikeOutAbility ABLE
>  ' *    TC_RA_ABLE = &H2000 '  Can do RasterFontAble ABLE
>  ' *    TC_VA_ABLE = &H4000 '  Can do VectorFontAble ABLE
>  ' *    TC_RESERVED = &H8000
>  ' *
>  ' *   Raster Capabilities
>  ' *    RC_BITBLT = 1'  Can do standard BLT.
>  ' *    RC_BANDING = 2'  Device requires banding support
>  ' *    RC_SCALING = 4'  Device requires scaling support
>  ' *    RC_BITMAP64 = 8'  Device can support >64K bitmap
>  ' *    RC_GDI20_OUTPUT = &H10 '  has 2.0 output calls
>  ' *    RC_DI_BITMAP = &H80 '  supports DIB to memory
>  ' *    RC_PALETTE = &H100 '  supports a palette
>  ' *    RC_DIBTODEV = &H200 '  supports DIBitsToDevice
>  ' *    RC_BIGFONT = &H400 '  supports >64K fonts
>  ' *    RC_STRETCHBLT = &H800 '  supports StretchBlt
>  ' *    RC_FLOODFILL = &H1000 '  supports FloodFill
>  ' *    RC_STRETCHDIB = &H2000 '  supports StretchDIBits
>  ' *
>  ' *   palette entry flags
>  ' *    PC_RESERVED = &H1 '  palette index used for animation
>  ' *    PC_EXPLICIT = &H2 '  palette index is explicit to device
>  ' *    PC_NOCOLLAPSE = &H4 '  do not match color to system palette
>  ' *
>  ' *   DIB color table identifiers
>  ' *    DIB_RGB_COLORS = 0'  color table in RGBTriples
>  ' *    DIB_PAL_COLORS = 1'  color table in palette indices
>  ' *********************************************************************
>
> FUNCTION GetDeviceCaps%%(indexval%%)
>    DIM hWin%,hDC%%
>
>    REGISTER CLEAR
>    REGISTER "User","GetActiveWindow","H"
>    REGISTER "User","GetDC","HH"
>    REGISTER "User","ReleaseDC","HHH"
>    REGISTER "GDI","GetDeviceCaps","HHH"
>
>    hWin% = CALL ("GetActiveWindow")
>    hDC%% = CALL ("GetDC",hWin%)
>    GetDeviceCaps%% = CALL ("GetDeviceCaps",hDC%%,indexval%%)
>    junk%% = CALL ("ReleaseDC",hWin%,hDC%%)
>    REGISTER CLEAR
>  END FUNCTION
>
> Have fun!
>
> Ciao, Neil 

Post Reply
Re: Screen Coordinates
Mon, 18 Feb 2008 10:10:45 +000
John Ciccone wrote:
> Is there a way of returning the display size in SB "Screen
Coordinates"?
> 
> Using Set Position for a window that should be as wide as possible, but of

> course monitors come in different sizes/resolutions.
> 
> What are these Screen Coordinates units? (If they're not pixels, what would

> they be?)

Using version 2, the only thing you can reasonably do is to call the OS 
using GetDeviceCaps(). Here is a function that should work:

  ' ********************************************************************
  ' * GetDeviceCaps%%(indexval%%) -- Public
  ' *
  ' * Calls the Windows function of the same name to inquire about
  ' * the capabilities of the current display driver.
  ' *
  ' *
  ' * Device Parameters for GetDeviceCaps()
  ' *    DRIVERVERSION = 0'  Device driver version
  ' *    TECHNOLOGY = 2'  Device classification
  ' *    HORZSIZE = 4'  Horizontal size in millimeters
  ' *    VERTSIZE = 6'  Vertical size in millimeters
  ' *    HORZRES = 8'  Horizontal width in pixels
  ' *    VERTRES = 10'  Vertical width in pixels
  ' *    BITSPIXEL = 12'  Number of bits per pixel
  ' *    PLANES = 14'  Number of planes
  ' *    NUMBRUSHES = 16'  Number of brushes the device has
  ' *    NUMPENS = 18'  Number of pens the device has
  ' *    NUMMARKERS = 20'  Number of markers the device has
  ' *    NUMFONTS = 22'  Number of fonts the device has
  ' *    NUMCOLORS = 24'  Number of colors the device supports
  ' *    PDEVICESIZE = 26'  Size required for device descriptor
  ' *    CURVECAPS = 28'  Curve capabilities
  ' *    LINECAPS = 30'  Line capabilities
  ' *    POLYGONALCAPS = 32'  Polygonal capabilities
  ' *    TEXTCAPS = 34'  Text capabilities
  ' *    CLIPCAPS = 36'  Clipping capabilities
  ' *    RASTERCAPS = 38'  Bitblt capabilities
  ' *    ASPECTX = 40'  Length of the X leg
  ' *    ASPECTY = 42'  Length of the Y leg
  ' *    ASPECTXY = 44'  Length of the hypotenuse
  ' *
  ' *    LOGPIXELSX = 88'  Logical pixels/inch in X
  ' *    LOGPIXELSY = 90'  Logical pixels/inch in Y
  ' *
  ' *    SIZEPALETTE = 104'  Number of entries in physical palette
  ' *    NUMRESERVED = 106'  Number of reserved entries in palette
  ' *    COLORRES = 108'  Actual color resolution
  ' *
  ' *
  ' *  Device Capability Masks:
  ' *
  ' *   Device Technologies
  ' *    DT_PLOTTER = 0'  Vector plotter
  ' *    DT_RASDISPLAY = 1'  Raster display
  ' *    DT_RASPRINTER = 2'  Raster printer
  ' *    DT_RASCAMERA = 3'  Raster camera
  ' *    DT_CHARSTREAM = 4'  Character-stream, PLP
  ' *    DT_METAFILE = 5'  Metafile, VDM
  ' *    DT_DISPFILE = 6'  Display-file
  ' *
  ' *   Curve Capabilities
  ' *    CC_NONE = 0'  Curves not supported
  ' *    CC_CIRCLES = 1'  Can do circles
  ' *    CC_PIE = 2'  Can do pie wedges
  ' *    CC_CHORD = 4'  Can do chord arcs
  ' *    CC_ELLIPSES = 8'  Can do ellipese
  ' *    CC_WIDE = 16'  Can do wide lines
  ' *    CC_STYLED = 32'  Can do styled lines
  ' *    CC_WIDESTYLED = 64'  Can do wide styled lines
  ' *    CC_INTERIORS = 128'  Can do interiors
  ' *
  ' *   Line Capabilities
  ' *    LC_NONE = 0'  Lines not supported
  ' *    LC_POLYLINE = 2'  Can do polylines
  ' *    LC_MARKER = 4'  Can do markers
  ' *    LC_POLYMARKER = 8'  Can do polymarkers
  ' *    LC_WIDE = 16'  Can do wide lines
  ' *    LC_STYLED = 32'  Can do styled lines
  ' *    LC_WIDESTYLED = 64'  Can do wide styled lines
  ' *    LC_INTERIORS = 128'  Can do interiors
  ' *
  ' *   Polygonal Capabilities
  ' *    PC_NONE = 0'  Polygonals not supported
  ' *    PC_POLYGON = 1'  Can do polygons
  ' *    PC_RECTANGLE = 2'  Can do rectangles
  ' *    PC_WINDPOLYGON = 4'  Can do winding polygons
  ' *    PC_TRAPEZOID = 4'  Can do trapezoids
  ' *    PC_SCANLINE = 8'  Can do scanlines
  ' *    PC_WIDE = 16'  Can do wide borders
  ' *    PC_STYLED = 32'  Can do styled borders
  ' *    PC_WIDESTYLED = 64'  Can do wide styled borders
  ' *    PC_INTERIORS = 128'  Can do interiors
  ' *
  ' *   Polygonal Capabilities
  ' *    CP_NONE = 0'  No clipping of output
  ' *    CP_RECTANGLE = 1'  Output clipped to rects
  ' *
  ' *   Text Capabilities
  ' *    TC_OP_CHARACTER = &H1 '  Can do OutputPrecision CHARACTER
  ' *    TC_OP_STROKE = &H2 '  Can do OutputPrecision STROKE
  ' *    TC_CP_STROKE = &H4 '  Can do ClipPrecision STROKE
  ' *    TC_CR_90 = &H8 '  Can do CharRotAbility 90
  ' *    TC_CR_ANY = &H10 '  Can do CharRotAbility ANY
  ' *    TC_SF_X_YINDEP = &H20 '  Can do ScaleFreedom X_YINDEPENDENT
  ' *    TC_SA_DOUBLE = &H40 '  Can do ScaleAbility DOUBLE
  ' *    TC_SA_INTEGER = &H80 '  Can do ScaleAbility INTEGER
  ' *    TC_SA_CONTIN = &H100 '  Can do ScaleAbility CONTINUOUS
  ' *    TC_EA_DOUBLE = &H200 '  Can do EmboldenAbility DOUBLE
  ' *    TC_IA_ABLE = &H400 '  Can do ItalisizeAbility ABLE
  ' *    TC_UA_ABLE = &H800 '  Can do UnderlineAbility ABLE
  ' *    TC_SO_ABLE = &H1000 '  Can do StrikeOutAbility ABLE
  ' *    TC_RA_ABLE = &H2000 '  Can do RasterFontAble ABLE
  ' *    TC_VA_ABLE = &H4000 '  Can do VectorFontAble ABLE
  ' *    TC_RESERVED = &H8000
  ' *
  ' *   Raster Capabilities
  ' *    RC_BITBLT = 1'  Can do standard BLT.
  ' *    RC_BANDING = 2'  Device requires banding support
  ' *    RC_SCALING = 4'  Device requires scaling support
  ' *    RC_BITMAP64 = 8'  Device can support >64K bitmap
  ' *    RC_GDI20_OUTPUT = &H10 '  has 2.0 output calls
  ' *    RC_DI_BITMAP = &H80 '  supports DIB to memory
  ' *    RC_PALETTE = &H100 '  supports a palette
  ' *    RC_DIBTODEV = &H200 '  supports DIBitsToDevice
  ' *    RC_BIGFONT = &H400 '  supports >64K fonts
  ' *    RC_STRETCHBLT = &H800 '  supports StretchBlt
  ' *    RC_FLOODFILL = &H1000 '  supports FloodFill
  ' *    RC_STRETCHDIB = &H2000 '  supports StretchDIBits
  ' *
  ' *   palette entry flags
  ' *    PC_RESERVED = &H1 '  palette index used for animation
  ' *    PC_EXPLICIT = &H2 '  palette index is explicit to device
  ' *    PC_NOCOLLAPSE = &H4 '  do not match color to system palette
  ' *
  ' *   DIB color table identifiers
  ' *    DIB_RGB_COLORS = 0'  color table in RGBTriples
  ' *    DIB_PAL_COLORS = 1'  color table in palette indices
  ' *********************************************************************

FUNCTION GetDeviceCaps%%(indexval%%)
    DIM hWin%,hDC%%

    REGISTER CLEAR
    REGISTER "User","GetActiveWindow","H"
    REGISTER "User","GetDC","HH"
    REGISTER "User","ReleaseDC","HHH"
    REGISTER "GDI","GetDeviceCaps","HHH"

    hWin% = CALL ("GetActiveWindow")
    hDC%% = CALL ("GetDC",hWin%)
    GetDeviceCaps%% = CALL ("GetDeviceCaps",hDC%%,indexval%%)
    junk%% = CALL ("ReleaseDC",hWin%,hDC%%)
    REGISTER CLEAR
  END FUNCTION

Have fun!

Post Reply
about | contact