Jump to content

Dislplay Vars


Recommended Posts

Heyho!

I want to display a var after i pressed a button

$ButtonGermanen = GUICtrlCreateButton("Berechnen", 10, 220)

GuiCtrlCreateLabel("Ausbeute: " & $GermanenbeuteProzent, 210, 200)

In this way it works:

Msgbox(0, "Ausbeute", $GermanenbeuteProzent & "%")

But i want to display it in the Window of my Gui
Link to comment
Share on other sites

  • Moderators

KillingEye,

Look at GUICtrlSetData in the Help file. :-)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Sry but the helpfilde does not help me.

Here is my complete Script:

#include <GuiConstantsEx.au3>

Opt("MustDeclareVars", 1)

; ====================================================================================================

===========================
; Description ...: -
; Author ........: Eye
; Notes .........:
; ====================================================================================================

===========================

; ====================================================================================================

===========================
; Global constants
; ====================================================================================================

===========================
Global Const $Legi = 40
Global Const $Praet = 20
Global Const $Imp = 50
Global Const $EImperatoris = 100
Global Const $ECaesaris = 70
Global Const $SiedlerR = 3000

Global Const $Keuli = 60
Global Const $Speer = 40
Global Const $Axti = 50
Global Const $Paladin = 110
Global Const $Teutone = 80
Global Const $SiedlerG = 3000

Global Const $Phalanx = 30
Global Const $Schwerti = 45
Global Const $Blitz = 75
Global Const $Druide = 35
Global Const $Haeduaner = 65
Global Const $SiedlerGallier = 3000




; ====================================================================================================

===========================
; Global VARS
; ====================================================================================================

===========================
Global $version = "v1.0"
Global $Legiinput, $Praetinput, $Impinput, $EImperatorisinput, $ECaesarisinput, $SiedlerRinput
Global $Keuliinput, $Speerinput, $Axtiinput, $Paladinput, $Teutoneninput, $SiedlerGinput
Global $Phalanxinput, $Schwertiinput, $Blitzinput, $Druideninput, $Haeduanerinput, $SiedlerGallierinput
Global $RoemerHolzinput, $RoemerLehminput, $RoemerEiseninput, $RoemerGetreideinput
Global $GermaneHolzinput, $GermaneLehminput, $GermaneEiseninput, $GermaneGetreideinput
Global $GallierHolzinput, $GallierLehminput, $GallierEiseninput, $GallierGetreideinput
Global $ButtonGallier, $ButtonRoemer, $ButtonGermanen
Global $roemerint, $roemerbeuteint, $RoemerbeuteProzent
Global $germaneint, $germanenbeuteint, $GermanenbeuteProzent
Global $gallierint, $gallierbeuteint, $GallierbeuteProzent
Global $test2


; ====================================================================================================

===========================
; Main
; ====================================================================================================

===========================

_Main()
MsgLoop()


Func _Main()
    Local $hGUI
    $hGUI = GUICreate("Ausbeute Rechner " & $version, 500, 300)
    
    

GuiCtrlCreateTab(5, 0, 490, 250)
GuiCtrlCreateTabItem("Römer") 
GuiCtrlCreateLabel("Legionär(e)", 10, 40)
$Legiinput = GuiCtrlCreateInput("", 70, 40, 60, 17)
GuiCtrlCreateLabel("Prätorianer", 10, 60)
$Praetinput = GuiCtrlCreateInput("", 70, 60, 60, 17)
GuiCtrlCreateLabel("Imperianer", 10, 80)
$Impinput = GuiCtrlCreateInput("", 70, 80, 60, 17)
GuiCtrlCreateLabel("Imperatoris", 10, 100)
$EImperatorisinput = GuiCtrlCreateInput("", 70, 100, 60, 17)
GuiCtrlCreateLabel("Caesaris", 10, 120)
$ECaesarisinput = GuiCtrlCreateInput("", 70, 120, 60, 17)
GuiCtrlCreateLabel("Siedler", 10, 140)
$SiedlerRinput = GuiCtrlCreateInput("", 70, 140, 60, 17)

GuiCtrlCreateGroup("Rohstoffe", 200, 25, 200, 150)
GuiCtrlCreateLabel("Holz:", 210, 60)
$RoemerHolzinput = GuiCtrlCreateInput("", 260, 60, 60, 17)
GuiCtrlCreateLabel("Lehm:", 210, 80)
$RoemerLehminput = GuiCtrlCreateInput("", 260, 80, 60, 17)
GuiCtrlCreateLabel("Eisen:", 210, 100)
$RoemerEiseninput = GuiCtrlCreateInput("", 260, 100, 60, 17)
GuiCtrlCreateLabel("Getreide:", 210, 120)
$RoemerGetreideinput = GuiCtrlCreateInput("", 260, 120, 60, 17)
GUICtrlCreateGroup ("",-99,-99,1,1) ;close group

$ButtonRoemer = GUICtrlCreateButton("Berechnen", 10, 220)

GuiCtrlCreateProgress(340, 220, 150, 20)
GuiCtrlSetData(-1,$RoemerbeuteProzent,0)
; ====================================================================================================

===========================

GuiCtrlCreateTabItem("Germane")
GuiCtrlCreateLabel("Keulenschwinger", 10, 40)
$Keuliinput = GuiCtrlCreateInput("", 100, 40, 60, 17)
GuiCtrlCreateLabel("Speerkämpfer", 10, 60)
$Speerinput = GuiCtrlCreateInput("", 100, 60, 60, 17)
GuiCtrlCreateLabel("Axtkämpfer", 10, 80)
$Axtiinput = GuiCtrlCreateInput("", 100, 80, 60, 17)
GuiCtrlCreateLabel("Paladin(e)", 10, 100)
$Paladinput = GuiCtrlCreateInput("", 100, 100, 60, 17)
GuiCtrlCreateLabel("Teutone(n)", 10, 120)
$Teutoneninput = GuiCtrlCreateInput("", 100, 120, 60, 17)
GuiCtrlCreateLabel("Siedler", 10, 140)
$SiedlerGinput = GuiCtrlCreateInput("", 100, 140, 60, 17)

GuiCtrlCreateGroup("Rohstoffe", 200, 25, 200, 150)
GuiCtrlCreateLabel("Holz:", 210, 60)
$GermaneHolzinput = GuiCtrlCreateInput("", 260, 60, 60, 17)
GuiCtrlCreateLabel("Lehm:", 210, 80)
$GermaneLehminput = GuiCtrlCreateInput("", 260, 80, 60, 17)
GuiCtrlCreateLabel("Eisen:", 210, 100)
$GermaneEiseninput = GuiCtrlCreateInput("", 260, 100, 60, 17)
GuiCtrlCreateLabel("Getreide:", 210, 120)
$GermaneGetreideinput = GuiCtrlCreateInput("", 260, 120, 60, 17)
GUICtrlCreateGroup ("",-99,-99,1,1) ;close group
$ButtonGermanen = GUICtrlCreateButton("Berechnen", 10, 220)

;GuiCtrlCreateLabel("Ausbeute: ", 210, 200)
;GUICtrlSetData(-1, $GermanenbeuteProzent)
GuiCtrlCreateProgress(340, 220, 150, 20)
GuiCtrlSetData(-1,$germanenbeuteProzent,0)
;GuiCtrlCreateLabel("Ausbeute", 200, 220)

; ====================================================================================================

===========================

GuiCtrlCreateTabItem("Gallier")
GuiCtrlCreateLabel("Phalanx(en)", 10, 40)
$Phalanxinput = GuiCtrlCreateInput("", 100, 40, 60, 17)
GuiCtrlCreateLabel("Schwertkämpfer", 10, 60)
$Schwertiinput = GuiCtrlCreateInput("", 100, 60, 60, 17)
GuiCtrlCreateLabel("Teutetesblitz(e)", 10, 80)
$Blitzinput = GuiCtrlCreateInput("", 100, 80, 60, 17)
GuiCtrlCreateLabel("Druidenreiter", 10, 100)
$Druideninput = GuiCtrlCreateInput("", 100, 100, 60, 17)
GuiCtrlCreateLabel("Haeduaner", 10, 120)
$Haeduanerinput = GuiCtrlCreateInput("", 100, 120, 60, 17)
GuiCtrlCreateLabel("Siedler", 10, 140)
$SiedlerGallierinput = GuiCtrlCreateInput("", 100, 140, 60, 17)

GuiCtrlCreateGroup("Rohstoffe", 200, 25, 200, 150)
GuiCtrlCreateLabel("Holz:", 210, 60)
$GallierHolzinput = GuiCtrlCreateInput("", 260, 60, 60, 17)
GuiCtrlCreateLabel("Lehm:", 210, 80)
$GallierLehminput = GuiCtrlCreateInput("", 260, 80, 60, 17)
GuiCtrlCreateLabel("Eisen:", 210, 100)
$GallierEiseninput = GuiCtrlCreateInput("", 260, 100, 60, 17)
GuiCtrlCreateLabel("Getreide:", 210, 120)
$GallierGetreideinput = GuiCtrlCreateInput("", 260, 120, 60, 17)
GUICtrlCreateGroup ("",-99,-99,1,1) ;close group

$ButtonGallier = GUICtrlCreateButton("Berechnen", 10, 220)

GuiCtrlCreateProgress(340, 220, 150, 20)
GuiCtrlSetData(-1,$GallierbeuteProzent,0)


GuiCtrlCreateTabItem("")
; ====================================================================================================

===========================




    GUISetState()
EndFunc


Func MsgLoop()
    While True
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                Exit
            Case $ButtonRoemer
                Roemer()
            Case $ButtonGermanen
                Germane()
            Case $ButtonGallier
                Gallier()

            
        EndSwitch
    WEnd
EndFunc



; ====================================================================================================

===========================
; Main
; ====================================================================================================

===========================


Func Roemer()
    $roemerint = Int(GuiCtrlRead($Legiinput) * $Legi + GuiCtrlRead($Praetinput) * $Praet + GuiCtrlRead($Impinput) * $Imp + GuiCtrlRead($EImperatorisinput) * $EImperatoris + GuiCtrlRead($ECaesarisinput) * $ECaesaris + GuiCtrlRead($SiedlerRinput) * $SiedlerR)
    $roemerbeuteint = Int(GuiCtrlRead($RoemerHolzinput) + GuiCtrlRead($RoemerLehminput) + GuiCtrlRead($RoemerEiseninput) + GuiCtrlRead($RoemerGetreideinput))
    $RoemerbeuteProzent = Int($roemerbeuteint/$roemerint*100)
;MsgBox(0, "Ausbeute", $RoemerbeuteProzent & "%")
EndFunc

Func Germane()
    $germaneint = Int(GuiCtrlRead($Keuliinput) * $Keuli + GuiCtrlRead($Speerinput) * $Speer + GuiCtrlRead($Axtiinput) * $Axti + GuiCtrlRead($Paladinput) * $Paladin  + GuiCtrlRead($Teutoneninput) * $Teutone + GuiCtrlRead($SiedlerGinput) * $SiedlerG)
    $germanenbeuteint = Int(GuiCtrlRead($GermaneHolzinput) + GuiCtrlRead($GermaneLehminput) + GuiCtrlRead($GermaneEiseninput) + GuiCtrlRead($GermaneGetreideinput))
    $GermanenbeuteProzent = Int($germanenbeuteint/$germaneint*100)
;Msgbox(0, "Ausbeute", $GermanenbeuteProzent & "%")

EndFunc

Func Gallier()
    Local $gallierint, $gallierbeuteint
    $gallierint = Int(GuiCtrlRead($Phalanxinput) * $Phalanx + GuiCtrlRead($Schwertiinput) * $Schwerti + GuiCtrlRead($Blitzinput) * $Blitz + GuiCtrlRead($Druideninput) * $Druide + GuiCtrlRead($Haeduanerinput) * $Haeduaner + GuiCtrlRead($SiedlerGallierinput) * $SiedlerGallier)
    $gallierbeuteint = Int(GuiCtrlRead($GallierHolzinput) + GuiCtrlRead($GallierLehminput) + GuiCtrlRead($GallierEiseninput) + GuiCtrlRead($GallierGetreideinput))
    $GallierbeuteProzent = Int($gallierbeuteint/$gallierint*100)
;Msgbox(0, "Ausbeute", $GallierbeuteProzent & "%")
    
EndFunc

Line 97 + 98

Line 129 + 130

Line 162 + 163

The Progressbar does not work with this.

I can't understand it.

Link to comment
Share on other sites

Progressbars are just like all of your other controls, you have to assign them a variable if you want to reference them later (like to change how much progress they're showing).

So everywhere you've got this:

GuiCtrlCreateProgress(340, 220, 150, 20)oÝ÷ Û*.ç¶è­mì!z·´ß«Ú®&è¬Â­z÷«ºxª¹ëÚ®&쨻kz
"hºÇºÚ"µÍÌÍÝXXHHÝZPÝÜX]TÙÜÜÊÍML
oÝ÷ Ù8^^*.Á©í¶©u«^^r'ârè·¬±¶«Ê·öYn±á®+k'­
«Z)¶¬Â«{Mú¦º ­ë,mªïj¸nW¢²Ø^½ªâi¹^¡ûazèë,mªò¢íý­ç!jx"§w0¢é]±ëb¶Ú!jWðk'î[az¶§è¬Ó]4jëh×6GuiCtrlSetData ($progressbarvariable, 50)
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...