Sign in to follow this  
Followers 0
BJJ

Problem with multi " Func "

7 posts in this topic

I want see two results so i used two func but i see only each result :)

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Opt ('GUIOnEventMode','1')

$Form1 = GUICreate("Form1", 305, 256, 192, 118)
$Label1 = GUICtrlCreateLabel("Ile lat palisz", 16, 16, 140, 25)
$Label2 = GUICtrlCreateLabel("Ile paczek na dobe", 16, 56, 140, 25)
$Label3 = GUICtrlCreateLabel("Cena paczki w zl", 16, 96, 140, 25)
$lata = GUICtrlCreateInput(" ", 168, 16, 65, 21)
$paczki = GUICtrlCreateInput(" ", 168, 56, 65, 21)
$cena = GUICtrlCreateInput(" ", 168, 96, 65, 21)
$Start = GUICtrlCreateButton("Button1", 80, 216, 145, 33, 0)

$lblwynik1 = GUICtrlCreateLabel("Na papierosy wydales : ", 16, 156, 140, 25)
$lblwynik = GUICtrlCreateLabel(" ", 140, 156, 140, 25)

$lblwynik3 = GUICtrlCreateLabel("Wypaliles : ", 16, 186, 140, 25)
$lblwynik2 = GUICtrlCreateLabel(" ", 140, 186, 140, 25)


GUISetOnEvent ($GUI_EVENT_CLOSE, '_Exit')

GUICtrlSetOnEvent ($Start, '_Start' )
GUICtrlSetOnEvent ($Start, '_Start2' )

GUISetState(@SW_SHOW, $Form1)

While '1'
Sleep ('150')
WEnd




Func _Start ()
GUICtrlSetData($lblwynik,_Result() & ' zl ')
EndFunc


Func _Result ()
    
$a_lata = GUICtrlRead($lata)
$a_paczki = GUICtrlRead($paczki)
$a_cena = GUICtrlRead($cena)

$rok = 365

$dni_palenia = ($a_lata * $rok)

$ilosc_paczek = ($dni_palenia * $a_paczki)

$wynik  = ($ilosc_paczek * $a_cena)


Return $wynik
EndFunc



Func _Start2 ()
GUICtrlSetData($lblwynik2,_Result2() & ' sztuk ')
EndFunc


Func _Result2 ()
    
$a_lata = GUICtrlRead($lata)
$a_paczki = GUICtrlRead($paczki)


$rok = 365
$fajki = 20

$dni_palenia = ($a_lata * $rok)

$ilosc_paczek = ($dni_palenia * $a_paczki)

$wynik2  = ($ilosc_paczek * $fajki)


Return $wynik2
EndFunc

How can I put more result in one Func ?

Share this post


Link to post
Share on other sites



difficult to understand as not English so i dont know what your doing really but did you want

Func _Start()
    GUICtrlSetData($lblwynik, _Result() & ' zl ')
    GUICtrlSetData($lblwynik2, _Result2() & ' zl ')
EndFunc  ;==>_Start

in the _start() func ?

also you have

GUICtrlSetOnEvent ($Start, '_Start' )

GUICtrlSetOnEvent ($Start, '_Start2' )

but you can only set the $start button to 1 func


Thx all,Jack Dinn.

 

JD's Auto Internet Speed Tester

JD's Clip Catch (With Screen Shot Helper)

Projects :- AutoIt - My projects

My software never has bugs. It just develops random features. :-D

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

So i cant make two difrent result when push one buton ??

I want to start two functions in one button or one function but two results

Tomorrow i change my code to English

Edited by Quzziy

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

well yea you can, did you try the added line i showed you ?

your line...

GUICtrlSetData($lblwynik, _Result() & ' zl '); so this one does the first func and displays the results in $lblwynik

add my line...

GUICtrlSetData($lblwynik2, _Result2() & ' zl '); and this does the second func and displays these results in $lblwynik2

o and dont forget to take out this line GUICtrlSetOnEvent ($Start, '_Start2' )

so you have got your two results .

is this not what your after?

Edited by JackDinn

Thx all,Jack Dinn.

 

JD's Auto Internet Speed Tester

JD's Clip Catch (With Screen Shot Helper)

Projects :- AutoIt - My projects

My software never has bugs. It just develops random features. :-D

Share this post


Link to post
Share on other sites

Thanks that work :)

But how cut result number I have 72.0562723 Days

I want have 72 Days

When have 72.9827262 Days

Want 73 Days

Share this post


Link to post
Share on other sites

Greate :)

Big Thanks JackDinn

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0