Board Logo
« Search Results »

Welcome Guest. Please Login or Register.
Sep 24th, 2017, 11:34pm


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


Search Results

Total results: 10


 1   Novice / Re: Adjusting program to suit display size  on: Today at 3:50pm
Started by donjohnson24 | Post by tenochtitlanuk ( John F)
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!
 
  Reply Quote Notify of replies

 2   Novice / Adjusting program to suit display size  on: Today at 12:35pm
Started by donjohnson24 | Post by donjohnson24
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.
 
  Reply Quote Notify of replies

 3   Novice / Re: Open File Detection  on: Yesterday at 2:04pm
Started by oxcart | Post by Rod
Away from home, how about on error coupled with read file, say first dummy record. Succeed = file open on error = file closed.
 
  Reply Quote Notify of replies

 4   Novice / Re: Open File Detection  on: Sep 22nd, 2017, 1:44pm
Started by oxcart | Post by tsh73
Just want to say.
It's harder then it seems.

I made a function that opens given file, and tried to intercept error with On Error.

But alas!
If I open file for input/append/binary, it does not error
And if I open it for Output, it errors if file already open -
BUT! if it opens file successfully it clears file content.

I don't think this is desirable behavior sad


 
  Reply Quote Notify of replies

 5   JB Programming Discussions / Re: Write a PDF file  on: Sep 22nd, 2017, 11:12am
Started by Angelo2449 | Post by tenochtitlanuk ( John F)
Just print the graphics as below, and select 'Print to PDF' rather than any real connected hardware when the dialog comes up. ( I leave that as the default on my machines to save paper wasting)
The '800' states what width you want the graphic to occupy on the page.
Code:
    nomainwin

    WindowWidth  =800
    WindowHeight =600

    open "Demo of graphics saved to a bmp" for graphics_nsb as #wg

    #wg "trapclose quit"

    #wg "fill 140 140 40"

    for i =1 to 10
        #wg "up ; goto "; int ( 700 *rnd( 1)); " "; int( 500 *rnd( 1))
        #wg "down"
        #wg "font arial "; 6 +int( 40 *rnd( 1))
        #wg "color     "; int( 256 *rnd( 1)); " "; int( 256 *rnd( 1)); " "; int( 256 *rnd( 1))
        #wg "backcolor "; int( 256 *rnd( 1)); " "; int( 256 *rnd( 1)); " "; int( 256 *rnd( 1))
        #wg "\"; "Graphics"
    next i

    #wg "print 800"
    '#wg "getbmp scr 0 0 800 600"
    'bmpsave "scr", "graphicEg.bmp"

    wait

    end

    sub quit h$
        close #wg
        end
    end sub

 

 
  Reply Quote Notify of replies

 6   JB Programming Discussions / Re: Write a PDF file  on: Sep 22nd, 2017, 10:41am
Started by Angelo2449 | Post by Facundo
Maybe using a virtual printer? or an external utility?
Here are some PDF creation code, by user code xd
Example of making a ugly pdf file
Create pdf with colors...

 
  Reply Quote Notify of replies

 7   JB Programming Discussions / Write a PDF file  on: Sep 22nd, 2017, 02:23am
Started by Angelo2449 | Post by Angelo2449
Hi Guys,
I wrote a program that generates a .bmp file, I would also like to get it in PDF format.
Is there any routine that can do it?
Thank you
 
  Reply Quote Notify of replies

 8   Novice / Re: Open File Detection  on: Sep 21st, 2017, 11:01am
Started by oxcart | Post by Rod
First choice would be to keep only necessary resources open as needed. Second choice would be to record in a global flag variable that a resource was already open and need not be opened again or indeed needed closed. Worsr case would be to use on error or similar to test something I had previously actioned.
 
  Reply Quote Notify of replies

 9   Novice / Re: Open File Detection  on: Sep 21st, 2017, 10:06am
Started by oxcart | Post by Facundo
Wouldn't be just using a variable good enough? if you now that the file is already "open" using fileIsOpen variable (or any variable name of your choice) close it first then set that variable to zero.
Another option, open the file and close it, don't leave it opened if you don't need anything from it.
Third:
If you want to catch the error try on error goto. Then read the Err$ and Err variables.
 
  Reply Quote Notify of replies

 10   Novice / Open File Detection  on: Sep 21st, 2017, 04:57am
Started by oxcart | Post by oxcart
One of my most common problems is trying to open or close a file or window that is already open somewhere else in my 'semi spaghetti' style code. Obviously JB knows if files / windows are open or closed or it would not kill execution and give an error message. Is there a way to detect this? In other words, could I always 'gosub' to check before opening or closing?

Like:

gosub [fileopencheck]
if fileopen = 1 then close "handl.txt'

[fileopencheck] IF "handl.txt" OPEN, then fileopen = 1 else
fileopen = 0
Return

before opening or closing?
 
  Reply Quote Notify of replies


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

Just BASIC wiki
Wikispaces

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