Jump to content
Sign in to follow this  
zzpot

Importing Data Into Gui

Recommended Posts

zzpot

Hlo Ppl

I have been working with this program for about a week.

Programing Background - Basic ( the original )

My question is about displaying data on a Gui or is it Koda screen (real time) !

I acutally dont know if it can be done.

Just a example ( Stock Exchange )

Just a example or if we wanted to track some price data and time ( Ebay )

Just a example lets say we wanted to build a calculator ( Basic )

Maybe I have it all wrong and the buttons just display or carry out control orders that are built into GUI.

Ok one more example.

Lets say we wanted to write a script that produced a random number every 10 seconds. How would we display this random number on the Gui that our loop was generating.

That simple script would probably start me in the right direction.

Thanks for any input on this you could give.

zz

Share this post


Link to post
Share on other sites
Valuater

you should see this tutorial...

http://www.autoitscript.com/forum/index.php?showtopic=21048#

but this is a script like you suggested

#include <GuiConstants.au3>

GUICreate("My Stock Market Analyser", 300, 200)
$label = GUICtrlCreateLabel("Press *Check Now* to see your stock value", 50, 100, 250, 20)
$btn = GUICtrlCreateButton("Check Now", 90, 150, 120, 20)
GUISetState()

While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then
        Exit
    EndIf
    
    if $msg = $btn Then Get_Stocks()
WEnd


Func Get_Stocks()
Dim $StockPrice
;In the middle of a stock market simulation game
$StockPriceChange = Random(-10, 10, 1) ; generate an integer between -10 and 10
$StockPrice = $StockPrice + $StockPriceChange
If $StockPriceChange < 0 Then
    GUICtrlSetData($label, "Your stock dropped to $" & $StockPrice)
ElseIf $StockPriceChange > 0 Then
    GUICtrlSetData($label, "Your stock rose $" & $StockPrice)
Else
    GUICtrlSetData($label, "Your stock stayed at $" & $StockPrice)
Endif

EndFunc

8)


NEWHeader1.png

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.