Board Logo
« getting started, Pigeon Breeders Records program »

Welcome Guest. Please Login or Register.
Jan 16th, 2018, 3:42pm


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 3 4 5  ...  11 Notify Send Topic Print
 veryhotthread  Author  Topic: getting started, Pigeon Breeders Records program  (Read 10805 times)
Rod
Administrator
ImageImageImageImageImage


member is offline

Avatar

Graphics = Goosebumps!


PM

Gender: Male
Posts: 3151
xx Re: getting started with Prog for Pigeon Breeding
« Reply #30 on: Mar 12th, 2016, 07:46am »

An example of listbox selection,pairing and deletion.

Code:
nomainwin
dim cock$(100)
dim hens$(100)
dim pair$(100)
pairpointer=1
cock$(1) = "First  Cock"
cock$(2) = "Second Cock"
cock$(3) = "Third  Cock"
cock$(4) = "Fourth Cock"
cock$(5) = "Fifth  Cock"
hens$(1) = "First  Hen"
hens$(2) = "Second Hen"
hens$(3) = "Third  Hen"
hens$(4) = "Fourth Hen"
hens$(5) = "Fifth  Hen"
statictext #bird.stc "Single click to select Cock",5,15,150,20
listbox #bird.cocks, cock$(), [cockSelection], 5, 35, 150, 90
statictext #bird.sth "Single click to select Hen",205,15,150,20
listbox #bird.hens, hens$(), [henSelection], 205, 35, 150, 90
statictext #bird.stp "Doubleclick click to delete pair",405,15,150,20
listbox #bird.pair, pair$(),[delete],405,35,200,90
WindowWidth = 800 : WindowHeight = 300
open "Select Pairs" for window as #bird
#bird.cocks "singleclickselect"
#bird.hens "singleclickselect"
#bird "trapclose [quit]"
wait

[cockSelection]
    #bird.cocks "selection? selection$"
    pair$(pairpointer)=selection$
    #bird.pair "Reload"
    cock=1
    wait

[henSelection]
if cock then
    #bird.hens "selection? selection$"
    pair$(pairpointer)=pair$(pairpointer)+"+"+selection$
    #bird.pair "Reload"
    pairpointer=pairpointer+1
    cock=0
end if
    wait

[delete]
    #bird.pair "selectionindex? i"
    m=1
    for n= 1 to pairpointer
        if n<>i then
        pair$(m)=pair$(n)
        m=m+1
        end if
    next
    #bird.pair "Reload"
    pairpointer=pairpointer-(pairpointer>1)

    wait

[quit]
close #bird
end




 
User IP Logged

Rod
Administrator
ImageImageImageImageImage


member is offline

Avatar

Graphics = Goosebumps!


PM

Gender: Male
Posts: 3151
xx Re: getting started with Prog for Pigeon Breeding
« Reply #31 on: Mar 12th, 2016, 07:54am »

If you were using Liberty BASIC you can remove the scroll bars with Stylebits, though they will reappear if the list gets longer than the box.

Code:
Stylebits #bird.cocks, 0, _LBS_DISABLENOSCROLL, 0, 0
Stylebits #bird.hens, 0, _LBS_DISABLENOSCROLL, 0, 0
Stylebits #bird.pair, 0, _LBS_DISABLENOSCROLL, 0, 0
statictext #bird.stc "Single click to select Cock",5,15,150,20
listbox #bird.cocks, cock$(), [cockSelection], 5, 35, 150, 90
statictext #bird.sth "Single click to select Hen",205,15,150,20
listbox #bird.hens, hens$(), [henSelection], 205, 35, 150, 90
statictext #bird.stp "Doubleclick click to delete pair",405,15,150,20
listbox #bird.pair, pair$(),[delete],405,35,200,90
WindowWidth = 800 : WindowHeight = 300
open "Select Pairs" for window as #bird
#bird.cocks "singleclickselect"
#bird.hens "singleclickselect"
#bird "trapclose [quit]"
wait
 
User IP Logged

stumpy
Full Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 148
xx Re: getting started with Prog for Pigeon Breeding
« Reply #32 on: Mar 12th, 2016, 09:37am »

'Listbox selection,pairing and deletion' is nice. I can live with the scroll bars or could perhaps overlap the left one with the left edge of the right listbox, and overwrite the right one by the placement of a static text box
User IP Logged

stumpy
Full Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 148
xx Re: getting started with Prog for Pigeon Breeding
« Reply #33 on: Mar 17th, 2016, 10:26am »

Hi. May I ask why, when the following code is run, and when birds ".......ghi....." or ".......mno......." are selected with the mouse, they don't get shown in the text positions above the list as "Selected Cock:-" and "Selected Hen:-"?

Those strings were made longer to illustrate that for some reason only the shorter strings get shown. What have I done wrong please?

Code:
[START]

gosub [loadData]
    listbox #main.cocks, cock$(), [selectCock], 710, 166, 250, 820
    listbox #main.hens, hen$(), [selectHen], 976, 166, 250, 820
    statictext #main, "SELECTED Cock:-                                                               SELECTED Hen:-", 676, 126, 1000, 20
    statictext #main, "(none)                                                                            (none)", 710, 143, 1000, 20
    statictext #main, "(none)", 976, 143, 40, 20
    statictext #main.labelcock, "", 676, 143, 200, 20
    statictext #main.labelhen, "", 947, 143, 200, 20
    nomainwin

'button panel

    button #main, "CLOSE", [quit], UL, 943, 86

    button #main, " SWAP selected Cock ", [SC], UL, 709, 2, 136, 25
    button #main, " SWAP selected Hen", [SH], UL, 1096, 2, 136, 25

    button #main, " EDIT/Add Cock", [EC], UL, 709, 30, 136, 25
    button #main, " EDIT/Add Hen", [EH], UL, 1096, 30, 136, 25

    button #main, "Pick Sire", [GPC], UL, 709, 59, 66, 25
    button #main, "Pick Dam", [GMC], UL, 779, 59, 66, 25
    button #main, "Pick Sire", [GPH], UL, 1096, 59, 66, 25
    button #main, "Pick Dam", [GMH], UL, 1165, 59, 66, 25

    button #main, "Load a Record", [LR], UL,910, 2, 132, 25
    button #main, "Save current Record", [SR], UL, 910, 30, 132, 25

    button #main, "Print current Pairs list", [PPr], UL, 910, 59, 132, 25
    button #main, "Print Cock's Pedigree", [PPed], UL, 709, 87, 136, 25
    button #main, "Print Hen's Pedigree", [PPed], UL, 1096, 87, 136, 25

'open window

    WindowWidth = 1920
    WindowHeight = 1080


open "Breeders Database v.3.01" for window as #main

    #main.cocks "singleclickselect [selectCock]"
    #main.hens "singleclickselect [selectHen]"

print #main, "trapclose [quit]"

[buttons]
    wait

[selectCock]
    #main.cocks "selection? item$"
    print #main.labelcock, "Cock: "; item$;
    wait

[selectHen]
    #main.hens "selection? item$"
    print #main.labelhen, "Hen: "; item$;
    wait

[SC]
   print
   wait

[SH]
    print
    wait

[EC]
    print
    wait

[EH]
    print
    wait

[GPC]
    print
    wait

[GMC]
   print
   wait

[GPH]
    print
    wait

[GMH]
    print
    wait

[LR]
    print
    wait

[SR]
   print
   wait

[PPr]
    print
    wait

[PPed]
    print
    wait

[quit]
'ask if the user wants to quit
    confirm "Record saved? Really Quit,?"; answer$
    if answer$ <> "yes" then wait 'abort quitting
    'now close the window
close #main
end

[loadData]

    for x = 0 to 2
      read a$
      cock$(x) = a$
    next x
    for x = 0 to 2
      read a$
      hen$(x) = a$
    next x
    return

    data "...............abc................", ".........def...................", ".....ghi......................................................."
    data "................jkl...............", ".........mno...................................................", "......pqr............."

    end


 
« Last Edit: Mar 17th, 2016, 10:39am by stumpy » User IP Logged

Rod
Administrator
ImageImageImageImageImage


member is offline

Avatar

Graphics = Goosebumps!


PM

Gender: Male
Posts: 3151
xx Re: getting started with Prog for Pigeon Breeding
« Reply #34 on: Mar 17th, 2016, 11:19am »

You set the statictext width to 200 pixels which isn't enough to show the full length of the text. Choose a better control to display variable length text, say a small texteditor
User IP Logged

stumpy
Full Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 148
xx Re: getting started with Prog for Pigeon Breeding
« Reply #35 on: Mar 17th, 2016, 1:45pm »

Right thanks. If feasible I would prefer textbox, to avoid the scroll bars of text editor, but it seems textbox is limited to showing too few characters, or can that be adjusted?
« Last Edit: Mar 17th, 2016, 1:48pm by stumpy » User IP Logged

Rod
Administrator
ImageImageImageImageImage


member is offline

Avatar

Graphics = Goosebumps!


PM

Gender: Male
Posts: 3151
xx Re: getting started with Prog for Pigeon Breeding
« Reply #36 on: Mar 17th, 2016, 2:37pm »

A textbox is bound by its pixel width also. You are trying to squeeze a quart into a pint pot. Your text either needs to be tiny or multi lined.
User IP Logged

stumpy
Full Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 148
xx Re: getting started with Prog for Pigeon Breeding
« Reply #37 on: Mar 17th, 2016, 6:07pm »

The points are well taken and have added text editors as recommended, with plenty of space still remaining either side, which will still serve for the family trees, and can manage with the current size of text, i.e. as printed on the screen.

This altered layout looks as if it might serve but can't now figure out how, when an item has been selected by the user from the lists, to extract a number for cock$(n) or hen$(n) for further use,
a.) would you help with that please?

- let alone how to deal with the text in the text editors: more swotting is required but meanwhile would you also mind looking at:

b.) the problem with 'cls' intended for the text editors, as noted in the 'rems' in [select cock] and [select hen] ?

c.) how to switch focus to either of the new text editors by clicking to edit the text in them?

Code:
dim cock$(50)
dim hen$(50)
[START]

gosub [loadData]
    listbox #main.cocks, cock$(), [selectCock], 710, 130, 250, 810
    listbox #main.hens, hen$(), [selectHen], 976, 130, 250, 810
    'statictext #main, "SELECTED Cock:-                                                     SELECTED Hen:-", 676, 130, 1000, 20
    'statictext #main, "(none.....)                                                                       (none.....)", 714, 150, 1000, 20

    'statictext #main.labelcock, "", 714, 150, 240, 20
    'statictext #main.labelhen, "", 980, 150, 240, 20
    nomainwin

'button panel

    TEXTEDITOR #main.labelcock, 650, 30, 250, 25
    TEXTEDITOR #main.labelhen, 1050, 30, 250, 25
    'textbox #main.labelcock, 709, 143, 230, 20

    button #main, "CLOSE", [quit], UL, 943, 86

    button #main, " SWAP selected Cock ", [SC], UL, 709, 2, 136, 25
    button #main, " SWAP selected Hen", [SH], UL, 1096, 2, 136, 25

    'button #main, " EDIT/Add Cock", [EC], UL, 709, 30, 136, 25
    'button #main, " EDIT/Add Hen", [EH], UL, 1096, 30, 136, 25

    button #main, "Pick Sire", [GPC], UL, 709, 59, 66, 25
    button #main, "Pick Dam", [GMC], UL, 779, 59, 66, 25
    button #main, "Pick Sire", [GPH], UL, 1096, 59, 66, 25
    button #main, "Pick Dam", [GMH], UL, 1165, 59, 66, 25

    button #main, "Load a Record", [LR], UL,910, 2, 132, 25
    button #main, "Save current Record", [SR], UL, 910, 30, 132, 25

    button #main, "Print current Pairs list", [PPr], UL, 910, 59, 132, 25
    button #main, "Print Cock's Pedigree", [PPed], UL, 709, 87, 136, 25
    button #main, "Print Hen's Pedigree", [PPed], UL, 1096, 87, 136, 25

'open window

    WindowWidth = 1920
    WindowHeight = 1080


open "Breeders Database v.3.01" for window as #main

    #main.cocks "singleclickselect [selectCock]"
    #main.hens "singleclickselect [selectHen]"

print #main, "trapclose [quit]"

[buttons]
    wait

[selectCock]
'    print #main.!cls, 650, 30, 250, 25     ****why doesn't this work to clear the texteditor?
    #main.cocks "selection? item$"
    print #main.labelcock, item$;
    wait

[selectHen]
 '    print #main.!cls, 1050, 30, 250, 25    ****why doesn't this work to clear the texteditor?
    #main.hens "selection? item$"
    print #main.labelhen, item$;
    wait

[SC]
   print
   wait

[SH]
    print
    wait

'[EC]
    'print
    'wait

'[EH]
    'print
    'wait

[GPC]
    print
    wait

[GMC]
   print
   wait

[GPH]
    print
    wait

[GMH]
    print
    wait

[LR]
    print
    wait

[SR]
   print
   wait

[PPr]
    print
    wait

[PPed]
    print
    wait

[quit]
'ask if the user wants to quit
    confirm "Record saved? Really Quit,?"; answer$
    if answer$ <> "yes" then wait 'abort quitting
    'now close the window
close #main
end

[loadData]

    for x = 1 to 50
      restore
      read a$
      x$ = str$(x)
      if x < 10 then x$ = x$ + "  "
      cock$(x) = "#" + x$ + "- " + a$
    next x
    for x = 1 to 50
      restore
      read a$
      x$ = str$(x)
      if x < 10 then x$ = x$ + "  "
      hen$(x) = "#" + x$ + "- " + a$
    next x
    return

    data "___________________________"
    'data "---------------------------"
    'data "123456789012345678901234567"

    end
 
« Last Edit: Mar 18th, 2016, 04:21am by stumpy » User IP Logged

Rod
Administrator
ImageImageImageImageImage


member is offline

Avatar

Graphics = Goosebumps!


PM

Gender: Male
Posts: 3151
xx Re: getting started with Prog for Pigeon Breeding
« Reply #38 on: Mar 18th, 2016, 04:57am »

No idea what you mean by N, do the birds not just stay in the list for reuse or will the list diminish as they are choosen, if so you will need to amend the array and reload the listbox.

You need to address the correct control to make cls work.
Code:
[selectCock]
    #main.labelcock "!cls"
    #main.cocks "selection? item$"
    #main.labelcock item$;
    wait

[selectHen]
    #main.labelhen "!cls"
    #main.hens "selection? item$"
    #main.labelhen item$;
    wait
 


The focus changes with the mouse click, I can click in the texteditor and alter the text.

One thing you are going to have to address is that few folks will run screens as big as yours. You window does not work on my computer which is 1600x900. Often folks don't like full screen programs, they prefer on screen windows that allows other programs and desktop applications to be seen. Something to think about.
User IP Logged

ezprogramming
Guest
xx Re: getting started with Prog for Pigeon Breeding
« Reply #39 on: Mar 18th, 2016, 05:23am »

Post deleted
« Last Edit: Sep 15th, 2016, 2:08pm by ezprogramming » User IP Logged

stumpy
Full Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 148
xx Re: getting started with Prog for Pigeon Breeding
« Reply #40 on: Mar 18th, 2016, 07:35am »

Terrific Rod, I can go again now.
on Mar 18th, 2016, 04:57am, Rod wrote:
No idea what you mean by N, do the birds not just stay in the list for reuse or will the list diminish as they are choosen, if so you will need to amend the array and reload the listbox.
Thanks for this clarification and that I will "...need to amend the array and reload the listbox" after trying any changes. I meant that I would have liked to identify with N the individual cock or hen within the array c$(50) or within array h$(50), and hoped that this could be done by identifying more easily to the JB prog. itself which c$/h$(n) was being displayed. (As it stands the screen does show '#' '(1-50)' but that only lets the user know!)

I have looked at your earlier example program illustrating pairpointers 1-5 for cocks and 1-5 for hens which has probably already provided the only feasible answer. I had hoped instead to be able to somehow extract the 'n' from the h$(n)-'s or c$(n)-'s which I have loaded into the listboxes.
I now suppose it may still be done by simply asking the user: e.g. "Swap with which #no. cock/hen?" or "New entry for cock/hen #no?" and getting a suitable a$ input...
Quote:
You need to address the correct control to make cls work.

Right that does the trick, thank you
Quote:
The focus changes with the mouse click, I can click in the texteditor and alter the text.
If you mean when running my current effort:- that does not happen for me. A bar does extend across the top of the screen, with clickable 'edit' dropdowns at the top left, but even that only appies to the hen's texteditor box.
Quote:
One thing you are going to have to address is that few folks will run screens as big as yours. You window does not work on my computer which is 1600x900. Often folks don't like full screen programs, they prefer on screen windows that allows other programs and desktop applications to be seen. Something to think about.
on Mar 18th, 2016, 05:23am, ezprogramming wrote:
My screen is 1920x1080, but because of the high native DPI (144) Windows, by default, scales it so that it appears to be 1280x720 as far as JB is concerned. Any program which assumes a bigger screen than that is generally unusable on this PC. Richard.
Rod and Richard both, thanks for pointing this out. My effort for Spectrum and later Amiga were much more low res. so needed much screen switching to fit everything in, so I was happy to go with using just one page and higher-res.

I do see that distribution would be crippled by that, and did offer my other progs as widely as feasible (and foc of course), but as far as I know I was the only user so, even with a tiny proportion of PCs, that could only improve!
« Last Edit: Mar 18th, 2016, 07:38am by stumpy » User IP Logged

tsh73
JB-Supporter


member is offline

Avatar




PM

Gender: Male
Posts: 3635
xx Re: getting started with Prog for Pigeon Breeding
« Reply #41 on: Mar 18th, 2016, 07:46am »

re: screensize
Consider that we here have trouble just *running* your program.
And we are here basically to help you.

So you are getting less help you could.
User IP Logged

Q: "And if I took your codes and compile them, and sell them for a profit"?
A: Go ahead. I had my share of good then I coded it for fun, if you can make better use of it - please do.
(enjoying JB 1.01 on WinXP, netbook and desktop)
Rod
Administrator
ImageImageImageImageImage


member is offline

Avatar

Graphics = Goosebumps!


PM

Gender: Male
Posts: 3151
xx Re: getting started with Prog for Pigeon Breeding
« Reply #42 on: Mar 18th, 2016, 08:11am »

Make your textditor deeper 25 pixels is not enough to show anything. You can parse out the bird number using mid$()
User IP Logged

stumpy
Full Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 148
xx Re: getting started with Prog for Pigeon Breeding
« Reply #43 on: Mar 18th, 2016, 08:36am »

Thanks again Rod for getting me going, and tsh73.

Looks like its back to the drawing board.
User IP Logged

ezprogramming
Guest
xx Re: getting started with Prog for Pigeon Breeding
« Reply #44 on: Mar 18th, 2016, 09:53am »

Post deleted
« Last Edit: Sep 15th, 2016, 2:08pm by ezprogramming » User IP Logged

Pages: 1 2 3 4 5  ...  11 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