Announcement

Collapse

Documentation

All current versions of the PowerBASIC documentation are available for download/viewing here:

PowerBASIC Links
See more
See less

Dialog pixels to units / dialog units to pixels

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Dialog pixels to units / dialog units to pixels

    In PBWin V10.04 the returns of these two statements are reversed.

    To make DIALOG UNITS TO PIXELS and DIALOG PIXELS TO UNITS version agnostic -
    '
    Code:
    #if %pb_revision = &h1004
      dialog units hDlg, x&, y& to pixels yy&, xx&
    #else  'versions 8.0x, 9.0x, 10.01, 10.02 and 10.03
      dialog units hDlg, x&, y& to pixels xx&, yy&
    #endif '
    and '
    Code:
    #if %pb_revision = &h1004
      dialog pixels hDlg, x&, y& to units yy&, xx&
    #else  versions 8.0x, 9.0x, 10.01, 10.02 and 10.03
      dialog pixels hDlg, x&, y& to units xx&, yy&
    #endif '
    Change the variable names to whatever is used in code.
    Use instead of the single line statements in code posted to, or copied from, the forms so it will work regardless of PBWin version. (other errors withstanding )


    Cheers,


    Dale

  • #2
    Arguably simpler
    Code:
    DIALOG UNITS hDlg, x&, y& TO PIXELS xx&, yy&
    #IF %PB_REVISION = &h1004
        SWAP xx&,yy&
    #ENDIF '
    AND '
    Code:
    DIALOG PIXELS hDlg, x&, y& TO UNITS xx&, yy&
    #IF %PB_REVISION = &h1004
        SWAP xx&,yy&
    #ENDIF '

    Comment


    • #3
      Shorter in source code, one more op at run time.
      added- if it is 10.04
      Last edited by Dale Yarker; 23 Mar 2022, 01:44 AM.
      Dale

      Comment

      Working...
      X