LB Booster
Programming >> Liberty BASIC language >> showing results instantly
http://lbb.conforums.com/index.cgi?board=lblang&action=display&num=1431938364

showing results instantly
Post by hammerjit on May 18th, 2015, 08:39am

hi, I need assistance on this code, cant seem to show the results instantly via the 'timer' command

Code:

    nomainwin

    WindowWidth = 944
    WindowHeight = 670

    groupbox #main.groupbox1, "Selection", 6, 6, 920, 80
    button #main.button1, "Button1", [button1Click], UL, 22, 36, 120, 25
    button #main.button2, "Button2", [button2Click], UL, 150, 36, 120, 25
    button #main.button3, "Button3", [button3Click], UL, 278, 36, 120, 25
    button #main.button4, "Button4", [button4Click], UL, 406, 36, 120, 25
    button #main.button5, "Button5", [button5Click], UL, 534, 36, 120, 25
    button #main.button6, "Button6", [button6Click], UL, 662, 36, 120, 25
    button #main.button7, "Button7", [button7Click], UL, 790, 36, 120, 25
    groupbox #main.groupbox2, "Entry", 6, 86, 920, 540
    groupbox #main.groupbox3, "Coupon Details", 14, 101, 320, 515
    groupbox #main.groupbox4, "Collected", 342, 106, 568, 270
    groupbox #main.groupbox5, "TOTAL", 342, 376, 552, 240
    statictext #main.statictext1, "Deno", 46, 121, 32, 20
    statictext #main.statictext2, "From", 126, 121, 32, 20
    statictext #main.statictext3, "To", 198, 121, 32, 20
    statictext #main.statictext4, "Total", 278, 121, 32, 20

    textbox #main.textbox1, 38, 146, 50, 25
    textbox #main.textbox2, 110, 146, 50, 25
    textbox #main.textbox3, 182, 146, 50, 25
    textbox #main.textbox4, 254, 146, 50, 25

    statictext #main.statictext5, "$  1.00", 366, 131, 56, 20
    statictext #main.statictext6, "$  2.00", 366, 161, 56, 20
    statictext #main.statictext7, "$  5.00", 366, 196, 56, 20
    statictext #main.statictext8, "$ 10.00", 366, 226, 64, 20
    statictext #main.statictext9, "$ 20.00", 366, 251, 64, 20
    statictext #main.statictext10, "$ 50.00", 366, 286, 64, 20
    statictext #main.statictext11, "$ 100.00", 366, 316, 72, 20
    textbox #main.textbox61, 446, 126, 50, 25
    textbox #main.textbox62, 446, 156, 50, 25
    textbox #main.textbox63, 446, 186, 50, 25
    textbox #main.textbox64, 446, 216, 50, 25
    textbox #main.textbox65, 446, 246, 50, 25
    textbox #main.textbox66, 446, 276, 50, 25
    textbox #main.textbox67, 446, 306, 50, 25
    textbox #main.textbox68, 518, 126, 100, 25
    textbox #main.textbox69, 518, 156, 100, 25
    textbox #main.textbox70, 518, 186, 100, 25
    textbox #main.textbox71, 518, 216, 100, 25
    textbox #main.textbox72, 518, 246, 100, 25
    textbox #main.textbox73, 518, 276, 100, 25
    textbox #main.textbox74, 518, 306, 100, 25

    statictext #main.statictext12, "$ 0.05", 646, 131, 56, 20
    statictext #main.statictext13, "$ 0.10", 646, 161, 56, 20
    statictext #main.statictext14, "$ 0.20", 646, 191, 56, 20
    statictext #main.statictext15, "$ 0.50", 646, 226, 56, 20
    textbox #main.textbox75, 710, 126, 50, 25
    textbox #main.textbox76, 710, 156, 50, 25
    textbox #main.textbox77, 710, 186, 50, 25
    textbox #main.textbox78, 710, 216, 50, 25
    textbox #main.textbox79, 782, 126, 100, 25
    textbox #main.textbox80, 782, 156, 100, 25
    textbox #main.textbox81, 782, 186, 100, 25
    textbox #main.textbox82, 782, 216, 100, 25

    statictext #main.statictext16, "Total Collected", 662, 336, 120, 20
    textbox #main.textbox83, 782, 331, 100, 25

    statictext #main.statictext17, "Total from Coupons", 422, 436, 144, 20
    textbox #main.textbox84, 606, 431, 100, 25
    statictext #main.statictext18, "Total Collected", 422, 486, 160, 20
    textbox #main.textbox85, 606, 481, 100, 25
    statictext #main.statictext19, "Different if any", 422, 531, 128, 20
    textbox #main.textbox86, 606, 526, 100, 25

    open "Finance" for window_nf as #main
    #main, "trapclose [quit]"
    print #main, "font ms_sans_serif 0 16"


[main.inputLoop]   'wait here for input event

    wait


timer 100, [main.button1Click]

[button1Click]   'Perform action for the button named 'button1'

    PRINT #main.textbox1, "!contents? ValueA1"
    PRINT #main.textbox2, "!contents? ValueA2"
    PRINT #main.textbox3, "!contents? ValueA3"

    PRINT #main.textbox61, "!contents? ValueP1"
    PRINT #main.textbox62, "!contents? ValueQ1"
    PRINT #main.textbox63, "!contents? ValueR1"
    PRINT #main.textbox64, "!contents? ValueS1"
    PRINT #main.textbox65, "!contents? ValueT1"
    PRINT #main.textbox66, "!contents? ValueU1"
    PRINT #main.textbox67, "!contents? ValueV1"

    PRINT #main.textbox75, "!contents? ValueW1"
    PRINT #main.textbox76, "!contents? ValueX1"
    PRINT #main.textbox77, "!contents? ValueY1"
    PRINT #main.textbox78, "!contents? ValueZ1"

let ValueA=(ValueA3-ValueA2+1)*ValueA1
let ValueP=(valueP1)*1
let ValueQ=(valueQ1)*2
let ValueR=(valueR1)*5
let ValueS=(valueS1)*10
let ValueT=(valueT1)*20
let ValueU=(valueU1)*50
let ValueV=(valueV1)*100
let ValueW=(valueW1)*.05
let ValueX=(valueX1)*.10
let ValueY=(valueY1)*.20
let ValueZ=(valueZ1)*.50

let subtotal1=ValueA
let subtotal2=ValueP+ValueQ+ValueR+ValueS+ValueT+ValueU+ValueV+ValueW+ValueX+ValueY+ValueZ

print #main.textbox4, ValueA
print #main.textbox68, ValueP
print #main.textbox69, ValueQ
print #main.textbox70, ValueR
print #main.textbox71, ValueS
print #main.textbox72, ValueT
print #main.textbox73, ValueU
print #main.textbox74, ValueV
print #main.textbox79, ValueW
print #main.textbox80, ValueX
print #main.textbox81, ValueY
print #main.textbox82, ValueZ

print #main.textbox83, subtotal2
print #main.textbox85, subtotal2
print #main.textbox84, subtotal1
print #main.textbox86, subtotal1-subtotal2

    wait


[button2Click]   'Perform action for the button named 'button2'
    'Insert your own code here
    wait


[button3Click]   'Perform action for the button named 'button3'
    'Insert your own code here
    wait


[button4Click]   'Perform action for the button named 'button4'
    'Insert your own code here
    wait


[button5Click]   'Perform action for the button named 'button5'
    'Insert your own code here
    wait


[button6Click]   'Perform action for the button named 'button6'
    'Insert your own code here
    wait


[button7Click]   'Perform action for the button named 'button7'
    'Insert your own code here
    wait

[quit]
timer 0
close #main
end
 

Re: showing results instantly
Post by Richard Russell on May 18th, 2015, 11:40am

on May 18th, 2015, 08:39am, hammerjit wrote:
cant seem to show the results instantly via the 'timer' command

Execution never reaches your TIMER command, because it is preceded by a WAIT:

Code:
    wait

    timer 100, [main.button1Click] 

WAIT always terminates a block of code:

Code:
    wait
    ' execution never gets to here
    print "This never happens" 

Richard.

Re: showing results instantly
Post by hammerjit on May 28th, 2015, 07:40am

Thanks Richard for the feedback.