Jump to content

Importing Data Into Gui


zzpot
 Share

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...