LB Booster
« Is this a dumb idea? »

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



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: Is this a dumb idea?  (Read 263 times)
Alincon
Full Member
ImageImageImage


member is offline

Avatar




PM


Posts: 147
xx Is this a dumb idea?
« Thread started on: Mar 7th, 2017, 8:37pm »

I wanted to enter a date by clicking, not typing.
I was unable to get a combo box to show 31 days, so I tried ranges.
You have to click once for range and once for item within range to choose days and years.

Code:
nomainwin
    dim months$(12), days$(11)
    for n = 1 to 12 : months$(n) = right$("0"+str$(n),2) : next
    days$(1) = "01-10":days$(2) = "11-20":days$(3) = "21-31"
    for n = 1 to 10 step 1: years$(n) = str$(n*10+1910)+"'s" : next

    WindowWidth = 400  :      WindowHeight = 400

    statictext #student.statictext6, "Date of Birth", 100,  5,  99,  20
    statictext #student.statictext7, "Mo        Day             Year", 70,  20,  160,  40

    combobox #student.mocb, months$(,[mos],60,40,40,60
    combobox #student.dacb, days$(,[days],107,40,50,50
    combobox #student.yrcb, years$(,[years],165,40,60,300

    open "Enter Date" for window as #student
    #student, "font ms_sans_serif 8"

    #student, "trapclose [studentEnd]"
    wait

 [studentEnd]
    #student.mocb, "selection? mx$"
    #student.dacb, "selection? dx$"
    #student.yrcb, "selection? decade$"
    notice mx$;" ";dx$;" ";decade$
    close #student
    end

 [mos]
    #student.mocb, "selection? mx$"
    wait

 [days]
    #student.dacb, "selection? da$"
    if instr(da$,"-") = 0 then wait
    #student.dacb, "selectionindex? dx"
    select dx
      case 1 : m = 0  : p = 10
      case 2 : m = 10  : p = 10
      case 3 : m = 20 : p = 11
    end select
    for n = 1 to p
        days$(n) = right$("0"+str$(n+m),2)
    next
    #student.dacb, "selectindex 0"
    #student.dacb,"reload"
    #student.dacb,"!";da$ 
    wait

 [years]
    #student.yrcb,"selection? decade$"
    if right$(decade$,1) <> "s" then wait
    decade = val(left$(decade$,4))
    for n = 1 to 10 :years$(n) = str$(decade+n-1):next
    #student.yrcb, "selectindex 0"
    #student.yrcb,"reload"
    #student.yrcb,"!";decade$ 
    wait

 
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Is this a dumb idea?
« Reply #1 on: Mar 7th, 2017, 10:51pm »

on Mar 7th, 2017, 8:37pm, Alincon wrote:
I was unable to get a combo box to show 31 days

What was the problem? I don't see any issues here with a combobox displaying 31 days. Admittedly a scrollbar is needed, by default, but you can override that so that all 31 days are shown if you want to (and your screen height is sufficient):

Code:
    nomainwin
    dim days$(31)
    for n = 1 to 31 : days$(n) = right$("0"+str$(n),2) : next

    WindowWidth = 400  :      WindowHeight = 400

    combobox #student.dacb, days$(),[days],107,40,50,200
    open "Enter Date" for window as #student
    #student, "font ms_sans_serif 8"
    #student, "trapclose [quit]"
    hdacb = hwnd(#student.dacb)
    calldll #user32, "SendMessageA", hdacb as ulong, _CB_SETMINVISIBLE as long, _
        31 as long, 0 as long, ret as void
    wait

[quit]
    close #student
    end 

Richard.
User IP Logged

Alincon
Full Member
ImageImageImage


member is offline

Avatar




PM


Posts: 147
xx Re: Is this a dumb idea?
« Reply #2 on: Mar 8th, 2017, 1:10pm »

I was not aware of the _CB_SETMINVISIBLE call - good to know.

But LB4.5 seems not to be aware of it either.

r.m.
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Is this a dumb idea?
« Reply #3 on: Mar 8th, 2017, 4:15pm »

on Mar 8th, 2017, 1:10pm, Alincon wrote:
But LB4.5 seems not to be aware of it either.

Not my problem! Indeed not a problem at all, so long as you know the numeric value (which LBB will tell you). grin

Richard.
User IP Logged

Alincon
Full Member
ImageImageImage


member is offline

Avatar




PM


Posts: 147
xx Re: Is this a dumb idea?
« Reply #4 on: Mar 8th, 2017, 7:10pm »

Agree that LB4.5 problems are not your problem.
At your suggestion, I printed the value of the constant in LBB
It's 5889, and that does work in LB4.5.

But back to the title question: is a two-step process for choosing date components too cumbersome? Choosing a year from 100 entries would involve more than one step, too.

I also wondered if anyone else would want to use combo boxes this way.

r.m.
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Is this a dumb idea?
« Reply #5 on: Mar 8th, 2017, 9:18pm »

on Mar 8th, 2017, 7:10pm, Alincon wrote:
But back to the title question: is a two-step process for choosing date components too cumbersome?

I wouldn't say it's "cumbersome" but personally I think it could be improved by automatically presenting the second list, without the user having to click again:

Code:
    nomainwin
    dim months$(12), days$(11)
    for n = 1 to 12 : months$(n) = right$("0"+str$(n),2) : next
    days$(1) = "01-10":days$(2) = "11-20":days$(3) = "21-31"
    for n = 1 to 10 step 1: years$(n) = str$(n*10+1910)+"'s" : next

    WindowWidth = 400  :      WindowHeight = 400

    statictext #student.statictext6, "Date of Birth", 100,  5,  99,  20
    statictext #student.statictext7, "Mo        Day             Year", 70,  20,  160,  40

    combobox #student.mocb, months$(,[mos],60,40,40,60
    combobox #student.dacb, days$(,[days],107,40,50,50
    combobox #student.yrcb, years$(,[years],165,40,60,300

    open "Enter Date" for window as #student
    #student, "font ms_sans_serif 8"

    #student, "trapclose [studentEnd]"
    wait

 [studentEnd]
    #student.mocb, "selection? mx$"
    #student.dacb, "selection? dx$"
    #student.yrcb, "selection? decade$"
    notice mx$;" ";dx$;" ";decade$
    close #student
    end

 [mos]
    #student.mocb, "selection? mx$"
    wait

 [days]
    #student.dacb, "selection? da$"
    if instr(da$,"-") = 0 then wait
    #student.dacb, "selectionindex? dx"
    select dx
      case 1 : m = 0  : p = 10
      case 2 : m = 10  : p = 10
      case 3 : m = 20 : p = 11
    end select
    for n = 1 to p
        days$(n) = right$("0"+str$(n+m),2)
    next
    #student.dacb, "selectindex 0"
    #student.dacb,"reload"
    #student.dacb,"!";da$ 
    hdacb = hwnd(#student.dacb)
    calldll #user32, "SendMessageA", hdacb as ulong, _CB_SHOWDROPDOWN as long, _
        1 as long, 0 as long, ret as void
    wait

 [years]
    #student.yrcb,"selection? decade$"
    if right$(decade$,1) <> "s" then wait
    decade = val(left$(decade$,4))
    for n = 1 to 10 :years$(n) = str$(decade+n-1):next
    #student.yrcb, "selectindex 0"
    #student.yrcb,"reload"
    #student.yrcb,"!";decade$ 
    hyrcb = hwnd(#student.yrcb)
    calldll #user32, "SendMessageA", hyrcb as ulong, _CB_SHOWDROPDOWN as long, _
        1 as long, 0 as long, ret as void
    wait 

Richard.
User IP Logged

Alincon
Full Member
ImageImageImage


member is offline

Avatar




PM


Posts: 147
xx Re: Is this a dumb idea?
« Reply #6 on: Mar 9th, 2017, 12:22am »

Nice improvement. Thanks
I didn't know the _CB_SHOWDROPDOWN call either.

r.m.
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