Board Logo
« Adjusting program to suit display size »

Welcome Guest. Please Login or Register.
Oct 17th, 2017, 3:29pm


Conforums Terms of Service | Membership Rules | Home | Search | Recent Posts | Notification | Format Your Message | Installation FAQ

Please use the forums Search feature before asking.
Please post code using the code box described in Format Your Messages.
This will keep indentation, separate it better form the message and prevent gibberish.
If the code is too long for one post or additional files are needed, upload a ZIP archive to the Just BASIC Files Archive Site.

« Previous Topic | Next Topic »
Pages: 1 2  Notify Send Topic Print
 hotthread  Author  Topic: Adjusting program to suit display size  (Read 400 times)
donjohnson24
Member in Training
ImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 20
xx Adjusting program to suit display size
« Thread started on: Sep 24th, 2017, 12:35pm »

I am an experienced programmer, but I am now 77 years old and my brain is slowing rapidly, so please make allowances!

I wrote a BASIC program years ago when computers used TVs as display screens, to show a Tote for horse-racing film nights. Over the years I changed it into C and other languages, finally having it now in justBASIC. You can see something about it at http://www.donjohnson24.co.uk/racenite.html

I struggle with GUI, so at present my opening code is as follows:

Code:
'RACENITE.BAS
mainwin 65 24

DIM     winr(9), bets(9,8), nwbet(8), pay(9)
DIM     racnm$(9),racsp$(9),hornm$(9,8),horsp$(9,8),info$(10,10)
GLOBAL  filenm$, pay1, payb, unit, roun$, less1, num$, odst$, rc, tot, w, a$, entr
num$ = "100012001250137515001625175018752000212522502500275030003333350040004500500055006000650070007500800085009000"
odst$ = "EVENS    6:5   5:4  11:8   6:4  13:8   7:4  15:8   2:1 85:40   9:4   5:2  11:4   3:1100:30   7:2   4:1   9:2   5:1  11:2   6:1  13:2   7:1  15:2   8:1  17:2   9:1"

[main]
    pay1=70
    payb=60
    unit=50
    roun$="F"
    less1=1
    filenm$ = "RACENITE.DAT"
    gosub [init]
[start]
    r1$ = ""
    ext$ = "N"
    While ext$ = "N"
        gosub[menu1]
        r = geta(42,14)
        r1$ = a$
        select case r1$
        case "1"
            gosub [adjust]
        case "2"
            gosub [entry]
        case "3"
            gosub [runtote]
        case "4"
            gosub [savdat]
        case "5"
            gosub [loddat]
        case "6"
            gosub [dispres]
        case "7"
            gosub [prntres]
        case "8"
            gosub [chkext]
        end select
    Wend
    End

[init]
    for i = 1 to 9
        racnm$(i) = "____________________"
        racsp$(i) = "____________________"
        winr(i) = 0
        pay(i) = 0
        for j = 1 to 8
            bets(i,j) = 0
            hornm$(i,j) = "____________________"
            horsp$(i,j) = "____________________"
        next j
    next i
    return

[menu1]
    cls
    locate 22, 2
    print "RACENIGHT PROGRAM"
    locate 18, 4
    print "1   Adjust Parameters"
    locate 18, 5
    print "2   Edit Names/Sponsors"
    locate 18, 6
    print "3   Enter Bets/Show Odds"
    locate 18, 7
    print "4   Save Data"
    locate 18, 8
    print "5   Load Data"
    locate 18, 9
    print "6   Display Results"
    locate 18, 10
    print "7   Print   Results"
    locate 18, 11
    print "8   Exit Program"
    locate 20, 14
    print "Select Option (1-8)"
    locate 10, 19
    print "Written by Don Johnson  www.donjohnson24.co.uk";
    return

 


I have to play around with Display Settings to get the text on the screens large enough to be seen, but this has to be done on the computer being used for the program. Is there any way I can get each window to size itself to the the display being used, to enable anyone to run the program on their computer, rather than just on mine?

I understand that I might not have made myself too clear, but hope that someone can deduce what I am trying to do, and point me at the functions needed.

I have vague ideas of finding the current display size and calculating window and font sizes from that info, but my old brain is really struggling with concepts. I was a lot more competent years ago playing with Informix and unix :'(

I may have asked something like this before, but it was years ago and memory is untrustworthy.
User IP Logged

Don Johnson (not the Film Star!)
e-mail me: don@donjohnson24.co.uk
personal web: http://www.donjohnson24.co.uk
tenochtitlanuk ( John F)
Full Member
ImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 421
xx Re: Adjusting program to suit display size
« Reply #1 on: Sep 24th, 2017, 3:50pm »

Good to see a UK programmer here- especially one around my age and apparently just 'over the hill'- I'm on the Bridgwater side of Taunton. a few miles away- some coincidence for a global product and forum!

I had a look at your site and description of the application. Not entirely sure about what your size/scale problem is. If you now use a digital projector, surely whatever you see on the computer screen will be what fills the projected screen?

I AM sure it is generally much easier to create a GUI screen rather than use the 'text window' you are using.

To get your sample code to run I had to change a few lines. 'geta1(' is invalid syntax. And with no included 'scan' I had trouble breaking out of your code.

Code:
    While ext$ = "N"
        gosub[menu1]
        scan                        ' added
        'r = geta(42,14)         ' remmed out
        input r1$
        'r1$ = a$                  ' remmed out
        select case r1$
 


It's not impossible I could call in on you, and might be able to help a bit. But I do seem to have been away from Somerset rather a lot in recent years. I always find sharing a programming problem helps me, 'tho I can't guarantee a solution!
User IP Logged

Visit my LB/JB pages at http://www.diga.me.uk/index.html
I use XP and Ubuntu Linux on old machines!
Rod
Administrator
ImageImageImageImageImage


member is offline

Avatar

Graphics = Goosebumps!


PM

Gender: Male
Posts: 3100
xx Re: Adjusting program to suit display size
« Reply #2 on: Sep 27th, 2017, 03:49am »

What you need to do is pick a popular screen size for the computers you are likely to use. Most screens are quite big these days 1366x768 seems to be the current favourite. If you can use a dedicated laptop that would save you a lot of trouble. If you must cater for a variety of screen sizes then what I would do is use a 1000x700 drawing space, that will fit on many screens. You will open a full screen graphic window, which might be 1366x768 but you will adjust your drawing coordinates to draw your 1000x700 text in the middle of the screen.

Using a graphics screen is. It much different to the text screen, you locate the cursor and print the text, you can also react to key presses so the program can look and feel just like it looks now.

When I get a bit more time I will show you some code that displays full screen text.
User IP Logged

rtr
Member in Training
ImageImage


member is online

Avatar




PM


Posts: 29
xx Re: Adjusting program to suit display size
« Reply #3 on: Sep 27th, 2017, 11:45am »

on Sep 27th, 2017, 03:49am, Rod wrote:
Most screens are quite big these days 1366x768 seems to be the current favourite.

This is complicated by Windows' automatic 'High DPI scaling'. My laptop is natively 1920x1080 pixels - 'full HD' resolution - but appears to Just BASIC (and any other 'non DPI-aware' application) as 1280x720.

Richard.
User IP Logged

bplus
Senior Member
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 1180
xx Re: Adjusting program to suit display size
« Reply #4 on: Sep 27th, 2017, 1:37pm »

Sorry, I don't see what the problem is. All the 7 screens from website, racenite will easily fit in the mainwin.

Here is the menu part of code fixed with an input statement in same gosub showing the menu, just keep asking for item 1 to 8 until get it, a scan should be added.
Code:
'RACENITE.BAS
mainwin 65 24

DIM     winr(9), bets(9,8), nwbet(8), pay(9)
DIM     racnm$(9),racsp$(9),hornm$(9,8),horsp$(9,8),info$(10,10)
GLOBAL  filenm$, pay1, payb, unit, roun$, less1, num$, odst$, rc, tot, w, a$, entr
num$ = "100012001250137515001625175018752000212522502500275030003333350040004500500055006000650070007500800085009000"
odst$ = "EVENS    6:5   5:4  11:8   6:4  13:8   7:4  15:8   2:1 85:40   9:4   5:2  11:4   3:1100:30   7:2   4:1   9:2   5:1  11:2   6:1  13:2   7:1  15:2   8:1  17:2   9:1"

[main]
    pay1=70
    payb=60
    unit=50
    roun$="F"
    less1=1
    filenm$ = "RACENITE.DAT"
    gosub [init]
[start]
    r1$ = ""
    ext$ = "N"
    While ext$ = "N"
        gosub[menu1]
        'r = geta(42,14) '??????????????
        '1$ = a$
        select case menu$
        case "1"
            gosub [adjust]
        case "2"
            gosub [entry]
        case "3"
            gosub [runtote]
        case "4"
            gosub [savdat]
        case "5"
            gosub [loddat]
        case "6"
            gosub [dispres]
        case "7"
            gosub [prntres]
        case "8"
            gosub [chkext]
        end select
    Wend
    End

[init]
    for i = 1 to 9
        racnm$(i) = "____________________"
        racsp$(i) = "____________________"
        winr(i) = 0
        pay(i) = 0
        for j = 1 to 8
            bets(i,j) = 0
            hornm$(i,j) = "____________________"
            horsp$(i,j) = "____________________"
        next j
    next i
    return

[menu1]
    cls
    locate 22, 2
    print "RACENIGHT PROGRAM"
    locate 18, 4
    print "1   Adjust Parameters"
    locate 18, 5
    print "2   Edit Names/Sponsors"
    locate 18, 6
    print "3   Enter Bets/Show Odds"
    locate 18, 7
    print "4   Save Data"
    locate 18, 8
    print "5   Load Data"
    locate 18, 9
    print "6   Display Results"
    locate 18, 10
    print "7   Print   Results"
    locate 18, 11
    print "8   Exit Program"
    locate 10, 19
    print "Written by Don Johnson  www.donjohnson24.co.uk"
    menuOK = 0
    while menuOK = 0
        scan
        locate 20, 14
        print space$(50)
        locate 20, 14
        input "Enter Option (1-8) ";menu$
        if val(menu$) >= 1 and val(menu$) <= 8 then menuOK = 1
    wend
    return

 


I would resurrect the old program in text first before going GUI with it. That would work out the bugs in the program and programmer.
« Last Edit: Sep 27th, 2017, 1:54pm by bplus » User IP Logged

B+
rtr
Member in Training
ImageImage


member is online

Avatar




PM


Posts: 29
xx Re: Adjusting program to suit display size
« Reply #5 on: Sep 28th, 2017, 01:42am »

on Sep 27th, 2017, 1:37pm, bplus wrote:
Sorry, I don't see what the problem is... I would resurrect the old program in text first before going GUI with it.

The OP states: "I have to play around with Display Settings to get the text on the screens large enough to be seen", which he wants to avoid. "Going GUI" is the only satisfactory way of changing the font size programmatically.

Richard.
User IP Logged

Rod
Administrator
ImageImageImageImageImage


member is offline

Avatar

Graphics = Goosebumps!


PM

Gender: Male
Posts: 3100
xx Re: Adjusting program to suit display size
« Reply #6 on: Sep 28th, 2017, 09:47am »

Ok, some code to help the discussion along. This opens full screen and uses the middle 1000x700 ish. You could enhance the graphics and have race images etc in the background.

This code attempts to mimic the mainwin and allow simple prnt() statements.

Code:
        nomainwin
    WindowWidth=DisplayWidth
    WindowHeight=DisplayHeight
    dw=1000
    dh=700
    xMargin=(DisplayWidth-dw)/2
    yMargin=(DisplayHeight-dh)/2
    global linc,lpos,xMargin,yMargin
    linc=40
    lpos=40



    ' open full screen graphics
    graphicbox #1.gb 0, 0, WindowWidth, WindowHeight
    open "Race Card" for window_popup as #1
    #1 "trapclose [quit]"
    #1.gb "down"
    'use a fixed width font so everything lines up
    #1.gb "font consolas 28 regular ; color black  ; backcolor white ; fill white"


    'set up menu selection 1
    [setupmenu1]
    'clear screen set line pointer to first line
    #1.gb "cls"
    lpos=linc
    ret=prnt(0,"01234567890123456789012345678901234567890123456789")
    ret=prnt(0,"ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWX")
    ret=prnt(0,"abcdefghijklmnopqrstuvwxyz1234567890--------------")
    ret=prnt(0,"")
    ret=prnt(0,"")
    ret=prnt(0,"")
    ret=prnt(400,"1 select menu 2")
    ret=prnt(400,"2 race meeting plan")
    ret=prnt(400,"3 calculate odds")
    ret=prnt(400,"Q to quit")
    'set handler for menu items
    #1.gb "setfocus; when characterInput [menu1]"
    wait

    [menu1]
    k$=Inkey$
    if upper$(k$)="Q" or asc(right$(k$,1))=_VK_ESCAPE  then [quit]
    if upper$(k$)="1" then goto [setupmenu2]
    if upper$(k$)="2" then [option2]
    if upper$(k$)="3" then [option3]

    wait

    'set up menu selection 2
    [setupmenu2]
    #1.gb "cls"
    lpos=7*linc
    ret=prnt(400,"1 Go Back to menu 1")
    ret=prnt(400,"2 choice 2")
    ret=prnt(400,"3 choice 3")
    ret=prnt(400,"Q to quit")
    'set new handler for this menu
    #1.gb "setfocus; when characterInput [menu2]"
    wait

    [menu2]
    k$=Inkey$
    if upper$(k$)="Q" or asc(right$(k$,1))=_VK_ESCAPE  then [quit]
    if upper$(k$)="1" then goto [setupmenu1]
    wait

    function prnt(x,t$)
    #1.gb "place ";xMargin+x;" ";yMargin+lpos;" ;\";t$
    lpos=lpos+linc
    prnt=lpos
    end function

    [quit]
    close #1
    end

 


Edit, tweaked the code to give 50 characters across a 1024 pixel screen.
« Last Edit: Sep 28th, 2017, 10:10am by Rod » User IP Logged

bplus
Senior Member
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 1180
xx Re: Adjusting program to suit display size
« Reply #7 on: Sep 28th, 2017, 10:19am »

on Sep 28th, 2017, 01:42am, rtr wrote:
The OP states: "I have to play around with Display Settings to get the text on the screens large enough to be seen", which he wants to avoid. "Going GUI" is the only satisfactory way of changing the font size programmatically.

Richard.


Oh, I see now what is needed. I apologize for my slowness.

It looks like Rod has very nice solution with his prnt function! but this line does not work for me:
Code:
 open "Race Card" for window_popup as #1
 

Maybe it works in Liberty or maybe it works in JB v 2.0 ;D

It works with just "graphics" instead of "window_popup".

I can read that text with my glasses off ten feet from the laptop!

Oh also, if you want to do an INPUT like Rod did the PRINT, I can advise on that but if you want to learn GUI, you better learn to do textboxes first.

Yes with graphics, you can colorize your text and make different sizes and jazz things up to your hearts content!
« Last Edit: Sep 28th, 2017, 10:36am by bplus » User IP Logged

B+
Rod
Administrator
ImageImageImageImageImage


member is offline

Avatar

Graphics = Goosebumps!


PM

Gender: Male
Posts: 3100
xx Re: Adjusting program to suit display size
« Reply #8 on: Sep 28th, 2017, 10:55am »

Oops, pop up is Liberty only but no matter it only hides the border, window of type graphic will do just as well. Also it shows how to mimic input into a graphics window, that was the main point of the demo.
« Last Edit: Sep 28th, 2017, 1:48pm by Rod » User IP Logged

bplus
Senior Member
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 1180
xx Re: Adjusting program to suit display size
« Reply #9 on: Sep 28th, 2017, 3:51pm »

Here is a stripped down version of my DE v6 code (DOS emulation sort of) that will simulate subs and functions that work in mainwin.

Code:
For:           use:
PRINT         call pl textToPrint$
LOCATE        call loc8 column, row
CLS           call clear r, g, b     eg call clear 255, 255, 255 clears to white background
INPUT         call inp myPrompt$, myReturnVariable$ 


I have many more substitute subs and functions but this is overwhelming enough!

Code:
'mainwin sim.txt
'DE 6.txt 2016-12-12 stripped down for Don Johnson to simulate mainwin functions

global xmax, ymax  'these two you can easily reset to your needs
'set these to screen width = xmax, screen height = ymax, that you want

xmax = 1000 : ymax = 700  '<<<<<< set this as you need or from plug-in notes

global cellW, cellH
'do not mess with cellW and cellH globals for printing
cellW = 14 'pixels wide for characters
cellH = 28 'pixels high for characters

global maxRow, maxCol
'and then these are calclated from above globals
maxCol = int(xmax / cellW)  'these control printing characters
maxRow = int(ymax / cellH)

global lastC, lastR 'for loc8 (locate), pl (print a line), lp (locate and print)
lastC = 1 : lastR = 1

'key events update globals with latest info
global inkee$


nomainwin

WindowWidth = xmax + 8
WindowHeight = ymax + 32
UpperLeftX = (DisplayWidth-WindowWidth) / 2
UpperLeftY = (DisplayHeight-WindowHeight) / 2

'graphicbox #gr, 2, 2, xmax-2, ymax-2
open "Testing Don Johnson's menu in stripped down DE v6" for graphics_nsb_nf as #gr '<, == change for plug in modules
#gr "trapclose quit"

'fonts that don't work arial, tahoma, verdana
'fonts that work
'#gr "font courier_new 10 20"
'#gr "font consolas 10 20"
#gr "font dejavu_sans_mono ";cellW;" ";cellH

'#gr "home"                  '< check drawing area
'#gr "posxy w2 h2"           '<<<<<<<<<<<<<<<<<<
'notice "Screen Drawing Check";chr$(13);"Size:" + chr$(13) + "Width (w2*2) = ";w2*2;",  Height (h2*2) = ";h2*2

#gr "setfocus"
#gr "when characterInput charIn"
#gr "color blue"  'have some fun with graphics screen
#gr "down"


'=================================================== plug-in main modules here


'RACENITE.BAS
'mainwin 65 24

DIM     winr(9), bets(9,8), nwbet(8), pay(9)
DIM     racnm$(9),racsp$(9),hornm$(9,8),horsp$(9,8),info$(10,10)
GLOBAL  filenm$, pay1, payb, unit, roun$, less1, num$, odst$, rc, tot, w, a$, entr
num$ = "100012001250137515001625175018752000212522502500275030003333350040004500500055006000650070007500800085009000"
odst$ = "EVENS    6:5   5:4  11:8   6:4  13:8   7:4  15:8   2:1 85:40   9:4   5:2  11:4   3:1100:30   7:2   4:1   9:2   5:1  11:2   6:1  13:2   7:1  15:2   8:1  17:2   9:1"

[main]
    pay1=70
    payb=60
    unit=50
    roun$="F"
    less1=1
    filenm$ = "RACENITE.DAT"
    gosub [init]
[start]
   ' r1$ = ""
    ext$ = "N"
    While ext$ = "N"
        gosub[menu1]
        'r = geta(42,14)
        'r1$ = a$

        'show new color background - remove next 3 lines when GOSUBs  are finished
        call clear 0, 255, 255
        call pl "You selected menu number ";menu$
        wait

        select case menu$
        case "1"
            gosub [adjust]
        case "2"
            gosub [entry]
        case "3"
            gosub [runtote]
        case "4"
            gosub [savdat]
        case "5"
            gosub [loddat]
        case "6"
            gosub [dispres]
        case "7"
            gosub [prntres]
        case "8"
            gosub [chkext]
        end select
    Wend
wait

[init]
    for i = 1 to 9
        racnm$(i) = "____________________"
        racsp$(i) = "____________________"
        winr(i) = 0
        pay(i) = 0
        for j = 1 to 8
            bets(i,j) = 0
            hornm$(i,j) = "____________________"
            horsp$(i,j) = "____________________"
        next j
    next i
    return

[menu1]
    call clear 255, 255, 255
    call loc8 22, 2
    call pl "RACENIGHT PROGRAM"
    call loc8 18, 4
    call pl "1   Adjust Parameters"
    call loc8 18, 5
    call pl "2   Edit Names/Sponsors"
    call loc8 18, 6
    call pl "3   Enter Bets/Show Odds"
    call loc8 18, 7
    call pl "4   Save Data"
    call loc8 18, 8
    call pl "5   Load Data"
    call loc8 18, 9
    call pl "6   Display Results"
    call loc8 18, 10
    call pl "7   Print   Results"
    call loc8 18, 11
    call pl "8   Exit Program"
    call loc8 20, 14
    call pl "Select Option (1-8)"
    call loc8 10, 19
    call pl "Written by Don Johnson  www.donjohnson24.co.uk"

    menuOK = 0
    while menuOK = 0
        scan
        call loc8 20, 14
        call pl space$(50)
        call loc8 20, 14
        call inp "Enter Option (1-8) ", menu$
        if val(menu$) >= 1 and val(menu$) <= 8 then menuOK = 1
    wend
    return


wait ' end plug-in section ======================================================================
'========================== DE procedures color, drawing, events very useful subs or functions

sub charIn hdl$, c$
    inkee$ = c$ 
end sub

sub quit hdl$
    timer 0
    close #gr
    end
end sub

sub clear r, g, b 'clear screen to new RGB color and set backcolor
' and set up so pl (print line) will start at line 1, cell column 1)
    #gr "fill ";r;" ";g;" ";b
    #gr "backcolor ";r;" ";g;" ";b
    lastC = 1 : lastR = 1
end sub

sub loc8 x, y   'locate xColumnCell, yRowCell for printing
    if 0 < x and x < maxCol + 1 and 0 < y and y < maxRow + 1 then
        lastC = x
        lastR = y
    end if
end sub

sub pl mess$ 'print line (feed)
    startR = lastR
    for i = 1 to len(mess$)
        scan
        call lp lastC, lastR, mid$(mess$, i, 1)
        if lastR <> startR then exit for
    next
    lastC = 1
    lastR = startR + 1
    if lastR > maxRow then lastR = maxRow 'yuck!
end sub

sub lp x, y, mess$ 'locate x, y : print mess$ lp = locate and print
    'if locate = x col and y row then and top left corner locates as 1, 1
    c = x - 1: r = y
    if 0 < x and x < maxCol + 1 and 0 < y and y < maxRow + 1 then
        #gr "place ";c * cellW;" ";r * cellH - 4
        #gr "|";mess$
        lastC = x + len(mess$)
        if lastC > maxCol then lastC = 1 : lastR = lastR + 1
        if lastR > maxRow then lastR = maxRow 'yuck!
    end if
end sub

sub cp y,cpText$ 'cp Center Print on line y the cpText$
    call lp int((maxCol-len(cpText$))/2+1.5),y,cpText$
end sub

sub inp prmpt$, byref var$   'input
'prints prompt at lastC, lastR and leaves lastC = 1 lastR = pRow + 1

    inkee$ = "" 'clear last key (new fix for DE5)
    call lp lastC, lastR, prmpt$;"{"
    'this will update lastR and lastC to the starting point of input variable
    pRow = lastR : pCol = lastC 'save these for redrawing var
    call lp pCol, pRow, "}"
    OK$ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz"
    OK$ = OK$+ chr$(8)+ chr$(27) + chr$(13) + "1234567890!@#$%^&*()_-+={}[]|\:;'<,>.?/"
    do
        scan
        if instr(OK$, inkee$) then
            if inkee$ = Chr$(8) then
                if t$ <> "" then
                    if Len(t$)=1 then t$="" else t$=Left$(t$,Len(t$)-1)
                end if
            else
                if inkee$=Chr$(13) or inkee$=Chr$(27) then
                    'new D5, I was expecting nothing in return for my esc
                    if inkee$ = chr$(27) then t$ = ""
                    exit do
                else
                    t$=t$;inkee$
                end if
            end if
            call lp pCol, pRow, t$;"} "
            inkee$ = ""
        end if
    loop until done
    var$ = t$
    lastC = 1 : lastR = pRow + 1
end sub

sub at xPix, yPix, char$  'print a string at pixel x, y This pin point locating.
    #gr "place ";xPix;" ";yPix
    #gr "|";char$ 
end sub

function wait4key$() 'updated for DE6 from sub to function like input$(1)
'This function stops program flow for keypress, and returns keypress
    inkee$ = ""
    while len(inkee$) = 0 : scan : k$ = inkee$ : wend
    wait4key$ = k$
end function

sub pause mil   'tsh version has scan built-in
    t0 = time$("ms")
    while time$("ms") < t0 + mil : scan : wend
end sub

 
« Last Edit: Sep 28th, 2017, 4:09pm by bplus » User IP Logged

B+
Rod
Administrator
ImageImageImageImageImage


member is offline

Avatar

Graphics = Goosebumps!


PM

Gender: Male
Posts: 3100
xx Re: Adjusting program to suit display size
« Reply #10 on: Sep 29th, 2017, 03:04am »

Yep you can roll the mainwin commands into graphic functions. This use a graphics window full screen with no side bars. On my 1600x900 system it give a pretty viewable text output middle of screen. It also works on a 1024x768 screen but that's the lowest resolution it will work at.

Code:
    nomainwin
    dw=1000
    dh=700
    xMargin=(DisplayWidth-dw)/2
    yMargin=(DisplayHeight-dh)/2
    global linc,lpos,xMargin,yMargin
    linc=40
    lpos=40



    ' open full screen graphics
    open "Race Card" for graphics_fs_nsb as #1
    #1 "trapclose [quit]"
    #1 "down"
    'use a fixed width font so everything lines up
    #1 "font consolas 28 regular ; color black  ; backcolor white ; fill white"


    'set up menu selection 1
    [setupmenu1]
    'clear screen set line pointer to first line
    #1 "cls"
    lpos=linc
    ret=prnt(0,"01234567890123456789012345678901234567890123456789")
    ret=prnt(0,"ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWX")
    ret=prnt(0,"abcdefghijklmnopqrstuvwxyz1234567890--------------")
    ret=prnt(0,"")
    ret=prnt(0,"")
    ret=prnt(0,"")
    ret=prnt(400,"1 select menu 2")
    ret=prnt(400,"2 race meeting plan")
    ret=prnt(400,"3 calculate odds")
    ret=prnt(400,"Q to quit")
    'set handler for menu items
    #1 "setfocus; when characterInput [menu1]"
    wait

    [menu1]
    k$=Inkey$
    if upper$(k$)="Q" or asc(right$(k$,1))=_VK_ESCAPE  then [quit]
    if upper$(k$)="1" then goto [setupmenu2]
    if upper$(k$)="2" then [option2]
    if upper$(k$)="3" then [option3]

    wait

    'set up menu selection 2
    [setupmenu2]
    #1 "cls"
    lpos=7*linc
    ret=prnt(400,"1 Go Back to menu 1")
    ret=prnt(400,"2 choice 2")
    ret=prnt(400,"3 choice 3")
    ret=prnt(400,"Q to quit")
    'set new handler for this menu
    #1 "setfocus; when characterInput [menu2]"
    wait

    [menu2]
    k$=Inkey$
    if upper$(k$)="Q" or asc(right$(k$,1))=_VK_ESCAPE  then [quit]
    if upper$(k$)="1" then goto [setupmenu1]
    wait

    function prnt(x,t$)
    #1 "place ";xMargin+x;" ";yMargin+lpos;" ;\";t$
    lpos=lpos+linc
    prnt=lpos
    end function

    [quit]
    close #1
    end


 
User IP Logged

donjohnson24
Member in Training
ImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 20
xx Re: Adjusting program to suit display size
« Reply #11 on: Sep 29th, 2017, 4:47pm »

Hi to all who responded to my query, and to whom I must apologise for failing to acknowledge or respond - on other forums I use, I receive an e-mail advising of responses, and I obviously have not got this set correctly here. Thus, when receiving no e-mails, I assumed that I had no replies, so did not bother to check until today.

Originally I was asking about trying to get the TEXT as large as possible on the screen, so in view of the the - apparent - lack of replies, I wound up my old brain and had a go myself.

I think I have been quite successful in satisfying the original aim, but struggled with this 'new fangled' idea of letting the user enter data whenever and wherever he chooses - it was much easier with sequential programming where we programmers decided the sequence of events. What concerned me was a user changing a textbox contents and the change not being updated. The 'when LeftMouseClick' function seemed to be a solution, but it does not work with the windows type I am using. Playing around with disabling and enabling textboxes and controls seems to be a fairly reasonable solutionl, but not absolutely foolproof.

I've rather enjoyed re-animating my programming skills, but as the new version file is rather large, I will try to do as suggested and post the current version of the program to the Just Basic Files Archive Site, under the name RACENITE.ZIP, which will include RACENITE.BAS and a sample RACENITE.DAT file to Load for some data.

I'm sure my program is not terribly elegant - not being able to index and fill textboxes from loops was really a pain in the Display Results function - and I trust you guys out there will not be too critical!

Many thanks, Don
User IP Logged

Don Johnson (not the Film Star!)
e-mail me: don@donjohnson24.co.uk
personal web: http://www.donjohnson24.co.uk
donjohnson24
Member in Training
ImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 20
xx Re: Adjusting program to suit display size
« Reply #12 on: Sep 29th, 2017, 5:16pm »

Well, I failed miserably to use the Archive - my username and password I use here were not accepted, but I couldn't register using that username as it was 'in use'. And then I struggled with the anti-spam functions titles.

So I gave up, and have posted it here: http://www.donjohnson24.co.uk/PalmDocs/ as RACENITE.ZIP

(RACENITEOLD.ZIP is the original version)

Please feel free to download and examine.
« Last Edit: Sep 29th, 2017, 5:29pm by donjohnson24 » User IP Logged

Don Johnson (not the Film Star!)
e-mail me: don@donjohnson24.co.uk
personal web: http://www.donjohnson24.co.uk
donjohnson24
Member in Training
ImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 20
xx Re: Adjusting program to suit display size
« Reply #13 on: Sep 29th, 2017, 5:39pm »

And yet another PS -

My email address has changed since I first registered years ago

If one Previews a post, the check box about notification gets cleared!
User IP Logged

Don Johnson (not the Film Star!)
e-mail me: don@donjohnson24.co.uk
personal web: http://www.donjohnson24.co.uk
bplus
Senior Member
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 1180
xx Re: Adjusting program to suit display size
« Reply #14 on: Sep 29th, 2017, 11:41pm »

Don, looks like you are progressing very nicely!

All those buttons look like allot of work! probably a labor of love, but has nice visual quality when done.
User IP Logged

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

Conforums Terms of Service | Membership Rules | Home | Search | Recent Posts | Notification | Format Your Message | Installation FAQ

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls