LB Booster
« adjustWindow routine »

Welcome Guest. Please Login or Register.
Apr 1st, 2018, 04:38am



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
We apologize Conforums does not have any export functions to migrate data.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

Thank you Conforums members.
Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
LB Booster Resources
LB Booster documentation
LB Booster Home Page
LB Booster technical Wiki
Just BASIC forum
BBC BASIC Home Page
Liberty BASIC forum (the original)

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: adjustWindow routine  (Read 344 times)
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx adjustWindow routine
« Thread started on: Nov 3rd, 2015, 12:52pm »

Anatoly's clever adjustWindow routine is very useful when you want to open a window which has precise (client area) dimensions. However it doesn't always work perfectly, because the values of slackX and slackY it calculates are always even numbers, so the resulting window size may be 'off by one'.

If it is important that the window dimensions are precise, to the pixel, the routine can be modified as listed below:

Code:
    desiredW = WindowWidth: desiredH= WindowHeight
    WindowWidth = 200: WindowHeight = 200
    open "" for graphics_nsb_nf as #gr ' change type as required
    #gr, "home ; down ; posxy x y"
    width = 2*x : height = 2*y
    close #gr
    slackX = 200-width: slackY = 200-height
    WindowWidth = 201: WindowHeight = 201
    open "" for graphics_nsb_nf as #gr ' change type as required
    #gr, "home ; down ; posxy x y"
    width = 2*x : height = 2*y
    close #gr
    if slackX <> 200-width  then slackX = slackX - 1
    if slackY <> 200-height then slackY = slackY - 1
    WindowWidth = desiredW + slackX
    WindowHeight =  desiredH + slackY 

The window type must of course be the same as that of the window you will eventually open, so change the graphics_nsb_nf in both places as necessary.

Richard.
« Last Edit: Nov 3rd, 2015, 1:04pm by Richard Russell » User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls