Skocz do zawartości
  • 👋 Witaj na MPCForum!

    Przeglądasz forum jako gość, co oznacza, że wiele świetnych funkcji jest jeszcze przed Tobą! 😎

    • Pełny dostęp do działów i ukrytych treści
    • Możliwość pisania i odpowiadania w tematach
    • System prywatnych wiadomości
    • Zbieranie reputacji i rozwijanie swojego profilu
    • Członkostwo w jednej z największych społeczności graczy

    👉 Dołączenie zajmie Ci mniej niż minutę – a zyskasz znacznie więcej!

    Zarejestruj się teraz

Wyskakujący MSGBOX


Rekomendowane odpowiedzi

Opublikowano

Siema, mam problem dodałem swój kod do tego co mi podesłał @Pawellek by mieć drugie okienko po zaznaczeniu checkboxa i wszystko jest ok tylko problem mam z MSGBOXEM od razu po odpaleniu programu sam się odpal a gdy się go chce wyłączyć to sam się od razu włącza ponownie(W sensie msgbox a nie program). Tutaj kod

	#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <WinAPIFiles.au3>
	Opt("GUIOnEventMode", 1)
	Global $g_hGUI2, $Button1, $Group1, $Combo1, $Combo2, $Combo3, $Combo4, $Combo5, $Combo6, $Combo7, $Combo8, $Combo9, $Combo10, $Combo11, $Combo12, $ap, $bp, $xp; Predeclare these variables
	gui1()
	Func gui1()
    Local $hGUI1 = GUICreate("SymStat", 215, 650, 100, 45)
    GUISetOnEvent($GUI_EVENT_CLOSE, "On_Close_Main") ; Run this function when the main GUI [X] is clicked
    Local $Group1 = GUICtrlCreateGroup("Statystyki", 8, 8, 201, 265)
Local $ap = GUICtrlCreateInput("200", 90, 40, 105, 21)
Local $bp = GUICtrlCreateInput("200", 90, 72, 105, 21)
Local $xp = GUICtrlCreateInput("200", 90, 104, 105, 21)
$Label1 = GUICtrlCreateLabel("AP", 16, 48, 70, 17)
$Label2 = GUICtrlCreateLabel("BP", 16, 80, 70, 17)
$Label3 = GUICtrlCreateLabel("XP", 16, 112, 70, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Ekwipunek", 8, 280, 201, 313)
Local $Combo1 = GUICtrlCreateCombo("Wybierz Item", 88, 296, 105, 25, BitOR($CBS_DROPDOWNLIST, $CBS_DROPDOWN, $CBS_AUTOHSCROLL))
Local $Combo2 = GUICtrlCreateCombo("Wybierz Item", 88, 320, 105, 25, BitOR($CBS_DROPDOWNLIST, $CBS_DROPDOWN, $CBS_AUTOHSCROLL))
$Label8 = GUICtrlCreateLabel("HELM", 16, 304, 70, 17)
$Label9 = GUICtrlCreateLabel("ZBROJA", 16, 328, 70, 17)
Local $Combo3 = GUICtrlCreateCombo("Wybierz Item", 88, 344, 105, 25, BitOR($CBS_DROPDOWNLIST, $CBS_DROPDOWN, $CBS_AUTOHSCROLL))
Local $Combo4 = GUICtrlCreateCombo("Wybierz Item", 88, 368, 105, 25, BitOR($CBS_DROPDOWNLIST, $CBS_DROPDOWN, $CBS_AUTOHSCROLL))
Local $Combo5 = GUICtrlCreateCombo("Wybierz Item", 88, 392, 105, 25, BitOR($CBS_DROPDOWNLIST, $CBS_DROPDOWN, $CBS_AUTOHSCROLL))
Local $Combo6 = GUICtrlCreateCombo("Wybierz Item", 88, 416, 105, 25, BitOR($CBS_DROPDOWNLIST, $CBS_DROPDOWN, $CBS_AUTOHSCROLL))
Local $Combo7 = GUICtrlCreateCombo("Wybierz Item", 88, 440, 105, 25, BitOR($CBS_DROPDOWNLIST, $CBS_DROPDOWN, $CBS_AUTOHSCROLL))
Local $Combo8 = GUICtrlCreateCombo("Wybierz Item", 88, 464, 105, 25, BitOR($CBS_DROPDOWNLIST, $CBS_DROPDOWN, $CBS_AUTOHSCROLL))
Local $Combo9 = GUICtrlCreateCombo("Wybierz Item", 88, 488, 105, 25, BitOR($CBS_DROPDOWNLIST, $CBS_DROPDOWN, $CBS_AUTOHSCROLL))
Local $Combo10 = GUICtrlCreateCombo("Wybierz Item", 88, 512, 105, 25, BitOR($CBS_DROPDOWNLIST, $CBS_DROPDOWN, $CBS_AUTOHSCROLL))
Local $Combo11 = GUICtrlCreateCombo("Wybierz Item", 88, 536, 105, 25, BitOR($CBS_DROPDOWNLIST, $CBS_DROPDOWN, $CBS_AUTOHSCROLL))
Local $Combo12 = GUICtrlCreateCombo("Wybierz Item", 88, 560, 105, 25, BitOR($CBS_DROPDOWNLIST, $CBS_DROPDOWN, $CBS_AUTOHSCROLL))
$Label10 = GUICtrlCreateLabel("SPODNIE", 16, 352, 70, 17)
Local $Button1 = GUICtrlCreateButton("KALKULUJ", 16, 600, 75, 41, $WS_GROUP)
    Local $idCheckBox1 = GUICtrlCreateCheckbox("Sklepowki", 120, 600, 75, 41)
    GUICtrlSetOnEvent(-1, "On_Checkbox1")
    GUISetState()
	EndFunc   ;==>gui1
	Func gui2()
    $g_hGUI2 = GUICreate("Sklepowe Przedmioty", 624, 629, 330, 55)
    GUISetOnEvent($GUI_EVENT_CLOSE, "On_Close_Secondary") ; Run this function when the secondary GUI [X] is clicked
    $Helmet = GUICtrlCreateLabel(">> Helm <<", 8, 32, 100, 17)
$Input1 = GUICtrlCreateInput("0", 8, 56, 49, 21)
$ZYCIE = GUICtrlCreateLabel("AP", 16, 8, 35, 17, $SS_CENTER)
$Label1 = GUICtrlCreateLabel("BP", 72, 8, 35, 17, $SS_CENTER)
$Input2 = GUICtrlCreateInput("0", 64, 56, 49, 21)
$KONDA = GUICtrlCreateLabel("XP", 120, 8, 42, 17, $SS_CENTER)
$Input3 = GUICtrlCreateInput("0", 120, 56, 49, 21)
$Input4 = GUICtrlCreateInput("0", 176, 56, 49, 21)
$Input5 = GUICtrlCreateInput("0", 232, 56, 49, 21)
$Input6 = GUICtrlCreateInput("0", 288, 56, 49, 21)
$Input7 = GUICtrlCreateInput("0", 344, 56, 49, 21)
$Input8 = GUICtrlCreateInput("0", 400, 56, 49, 21)
$Input9 = GUICtrlCreateInput("0", 456, 56, 49, 21)
$Input10 = GUICtrlCreateInput("0", 512, 56, 49, 21)
$Input11 = GUICtrlCreateInput("0", 568, 56, 49, 21)
$Input12 = GUICtrlCreateInput("0", 8, 104, 49, 21)
$Label10 = GUICtrlCreateLabel(">> Zbroja <<", 8, 80, 100, 17)
$Input13 = GUICtrlCreateInput("0", 64, 104, 49, 21)
$Input14 = GUICtrlCreateInput("0", 120, 104, 49, 21)
$Input15 = GUICtrlCreateInput("0", 176, 104, 49, 21)
$Input16 = GUICtrlCreateInput("0", 232, 104, 49, 21)
$Input17 = GUICtrlCreateInput("0", 288, 104, 49, 21)
$Input18 = GUICtrlCreateInput("0", 344, 104, 49, 21)
$Input19 = GUICtrlCreateInput("0", 400, 104, 49, 21)
$Input20 = GUICtrlCreateInput("0", 456, 104, 49, 21)
$Input21 = GUICtrlCreateInput("0", 512, 104, 49, 21)
$Input22 = GUICtrlCreateInput("0", 568, 104, 49, 21)
$Input23 = GUICtrlCreateInput("0", 8, 152, 49, 21)
$Label11 = GUICtrlCreateLabel(">> Spodnie <<", 8, 128, 100, 17)
$Input24 = GUICtrlCreateInput("0", 64, 152, 49, 21)
$Input25 = GUICtrlCreateInput("0", 120, 152, 49, 21)
$Input26 = GUICtrlCreateInput("0", 176, 152, 49, 21)
$Input27 = GUICtrlCreateInput("0", 232, 152, 49, 21)
$Input28 = GUICtrlCreateInput("0", 288, 152, 49, 21)
$Input29 = GUICtrlCreateInput("0", 344, 152, 49, 21)
$Input30 = GUICtrlCreateInput("0", 400, 152, 49, 21)
$Input31 = GUICtrlCreateInput("0", 456, 152, 49, 21)
$Input32 = GUICtrlCreateInput("0", 512, 152, 49, 21)
$Input33 = GUICtrlCreateInput("0", 568, 152, 49, 21)
$Input34 = GUICtrlCreateInput("0", 8, 200, 49, 21)
    GUISetState()
EndFunc   ;==>gui2
	While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $Button1
            calculate()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd
	
Func On_Close_Main()
    Exit
EndFunc   ;==>On_Close_Main
	Func On_Close_Secondary()
    GUIDelete($g_hGUI2)
	EndFunc   ;==>On_Close_Secondary
	Func On_Checkbox1()
    If _IsChecked(@GUI_CtrlId) Then
        gui2()
    Else
        On_Close_Secondary()
    EndIf
EndFunc   ;==>On_Button2
	Func _IsChecked($idControlID)
    Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED
EndFunc   ;==>_IsChecked
Func calculate()
    Local $calcAP = GUICtrlRead($ap)
    Local $calcBP = GUICtrlRead($bp)
    Local $calcXP = GUICtrlRead($xp)
	
    Local $f
    Local $arr[12] = ["helm", "zbroja", "spodnie"]
	    For $i = 0 To UBound($arr) - 1
        $f = @ScriptDir & "\eq\" & $arr[$i] & ".ini"
	        Switch $arr[$i]
            Case "helm"
                $readcombo = GUICtrlRead($Combo1)
            Case "zbroja"
                $readcombo = GUICtrlRead($Combo2)
            Case "spodnie"
                $readcombo = GUICtrlRead($Combo3)
        EndSwitch
	        $calcHP = Execute($calcAP & IniRead($f, $readcombo, "AP", "+0"))
        $calcMP = Execute($calcBP & IniRead($f, $readcombo, "BP", "+0"))
        $calcXP = Execute($calcXP & IniRead($f, $readcombo, "XP", "+0"))
	    Next
	    MsgBox(0, "Calculated", "AP: " & $calcHP & @CRLF & _
                            "BP: " & $calcMP & @CRLF & _
                            "XP: " & $calcXP )
	EndFunc   ;==>calculate

10 20 | 30 | 40 | 50 | 60 | 70 | 80 | 90 | 100 | 200 | 300 400 | 500 | 600 | 700 | 800 | 900 | 1000logoskillowcy.png

 

Opublikowano

miałeś wadliwą obsługę zdarzeń. w ogóle dziwnie jest zrobiona więc pozmieniałem trochę. wygląda na to że teraz działa

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <WinAPIFiles.au3>
;--------------------------------------------------------

    $hGUI1 = GUICreate("SymStat", 215, 650, 100, 45)
	GUISetState(@SW_SHOW)
    $Group1 = GUICtrlCreateGroup("Statystyki", 8, 8, 201, 265)
	$ap = GUICtrlCreateInput("200", 90, 40, 105, 21)
	$bp = GUICtrlCreateInput("200", 90, 72, 105, 21)
	$xp = GUICtrlCreateInput("200", 90, 104, 105, 21)
	
	$Label1 = GUICtrlCreateLabel("AP", 16, 48, 70, 17)
	$Label2 = GUICtrlCreateLabel("BP", 16, 80, 70, 17)
	$Label3 = GUICtrlCreateLabel("XP", 16, 112, 70, 17)
	
	GUICtrlCreateGroup("", -99, -99, 1, 1)
	$Group2 = GUICtrlCreateGroup("Ekwipunek", 8, 280, 201, 313)
	$Combo1 = GUICtrlCreateCombo("Wybierz Item", 88, 296, 105, 25, BitOR($CBS_DROPDOWNLIST, $CBS_DROPDOWN, $CBS_AUTOHSCROLL))
	$Combo2 = GUICtrlCreateCombo("Wybierz Item", 88, 320, 105, 25, BitOR($CBS_DROPDOWNLIST, $CBS_DROPDOWN, $CBS_AUTOHSCROLL))
	$Label8 = GUICtrlCreateLabel("HELM", 16, 304, 70, 17)
	$Label9 = GUICtrlCreateLabel("ZBROJA", 16, 328, 70, 17)
	$Combo3 = GUICtrlCreateCombo("Wybierz Item", 88, 344, 105, 25, BitOR($CBS_DROPDOWNLIST, $CBS_DROPDOWN, $CBS_AUTOHSCROLL))
	$Combo4 = GUICtrlCreateCombo("Wybierz Item", 88, 368, 105, 25, BitOR($CBS_DROPDOWNLIST, $CBS_DROPDOWN, $CBS_AUTOHSCROLL))
	$Combo5 = GUICtrlCreateCombo("Wybierz Item", 88, 392, 105, 25, BitOR($CBS_DROPDOWNLIST, $CBS_DROPDOWN, $CBS_AUTOHSCROLL))
	$Combo6 = GUICtrlCreateCombo("Wybierz Item", 88, 416, 105, 25, BitOR($CBS_DROPDOWNLIST, $CBS_DROPDOWN, $CBS_AUTOHSCROLL))
	$Combo7 = GUICtrlCreateCombo("Wybierz Item", 88, 440, 105, 25, BitOR($CBS_DROPDOWNLIST, $CBS_DROPDOWN, $CBS_AUTOHSCROLL))
	$Combo8 = GUICtrlCreateCombo("Wybierz Item", 88, 464, 105, 25, BitOR($CBS_DROPDOWNLIST, $CBS_DROPDOWN, $CBS_AUTOHSCROLL))
	$Combo9 = GUICtrlCreateCombo("Wybierz Item", 88, 488, 105, 25, BitOR($CBS_DROPDOWNLIST, $CBS_DROPDOWN, $CBS_AUTOHSCROLL))
	$Combo10 = GUICtrlCreateCombo("Wybierz Item", 88, 512, 105, 25, BitOR($CBS_DROPDOWNLIST, $CBS_DROPDOWN, $CBS_AUTOHSCROLL))
	$Combo11 = GUICtrlCreateCombo("Wybierz Item", 88, 536, 105, 25, BitOR($CBS_DROPDOWNLIST, $CBS_DROPDOWN, $CBS_AUTOHSCROLL))
	$Combo12 = GUICtrlCreateCombo("Wybierz Item", 88, 560, 105, 25, BitOR($CBS_DROPDOWNLIST, $CBS_DROPDOWN, $CBS_AUTOHSCROLL))
	$Label10 = GUICtrlCreateLabel("SPODNIE", 16, 352, 70, 17)
	$Button1 = GUICtrlCreateButton("KALKULUJ", 16, 600, 75, 41, $WS_GROUP)
	Local $idCheckBox1 = GUICtrlCreateCheckbox("Sklepowki", 120, 600, 75, 41)
;----------------------------------------------------------------------------

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $Button1
            calculate()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd
;--------------------------------------------------------------------------

Func gui2()
	$g_hGUI2 = GUICreate("Sklepowe Przedmioty", 624, 629, 330, 55)
	GUISetOnEvent($GUI_EVENT_CLOSE, "On_Close_Secondary") ; Run this function when the secondary GUI [X] is clicked
	$Helmet = GUICtrlCreateLabel(">> Helm <<", 8, 32, 100, 17)
	$Input1 = GUICtrlCreateInput("0", 8, 56, 49, 21)
	$ZYCIE = GUICtrlCreateLabel("AP", 16, 8, 35, 17, $SS_CENTER)
	$Label1 = GUICtrlCreateLabel("BP", 72, 8, 35, 17, $SS_CENTER)
	$Input2 = GUICtrlCreateInput("0", 64, 56, 49, 21)
	$KONDA = GUICtrlCreateLabel("XP", 120, 8, 42, 17, $SS_CENTER)
	$Input3 = GUICtrlCreateInput("0", 120, 56, 49, 21)
	$Input4 = GUICtrlCreateInput("0", 176, 56, 49, 21)
	$Input5 = GUICtrlCreateInput("0", 232, 56, 49, 21)
	$Input6 = GUICtrlCreateInput("0", 288, 56, 49, 21)
	$Input7 = GUICtrlCreateInput("0", 344, 56, 49, 21)
	$Input8 = GUICtrlCreateInput("0", 400, 56, 49, 21)
	$Input9 = GUICtrlCreateInput("0", 456, 56, 49, 21)
	$Input10 = GUICtrlCreateInput("0", 512, 56, 49, 21)
	$Input11 = GUICtrlCreateInput("0", 568, 56, 49, 21)
	$Input12 = GUICtrlCreateInput("0", 8, 104, 49, 21)
	$Label10 = GUICtrlCreateLabel(">> Zbroja <<", 8, 80, 100, 17)
	$Input13 = GUICtrlCreateInput("0", 64, 104, 49, 21)
	$Input14 = GUICtrlCreateInput("0", 120, 104, 49, 21)
	$Input15 = GUICtrlCreateInput("0", 176, 104, 49, 21)
	$Input16 = GUICtrlCreateInput("0", 232, 104, 49, 21)
	$Input17 = GUICtrlCreateInput("0", 288, 104, 49, 21)
	$Input18 = GUICtrlCreateInput("0", 344, 104, 49, 21)
	$Input19 = GUICtrlCreateInput("0", 400, 104, 49, 21)
	$Input20 = GUICtrlCreateInput("0", 456, 104, 49, 21)
	$Input21 = GUICtrlCreateInput("0", 512, 104, 49, 21)
	$Input22 = GUICtrlCreateInput("0", 568, 104, 49, 21)
	$Input23 = GUICtrlCreateInput("0", 8, 152, 49, 21)
	$Label11 = GUICtrlCreateLabel(">> Spodnie <<", 8, 128, 100, 17)
	$Input24 = GUICtrlCreateInput("0", 64, 152, 49, 21)
	$Input25 = GUICtrlCreateInput("0", 120, 152, 49, 21)
	$Input26 = GUICtrlCreateInput("0", 176, 152, 49, 21)
	$Input27 = GUICtrlCreateInput("0", 232, 152, 49, 21)
	$Input28 = GUICtrlCreateInput("0", 288, 152, 49, 21)
	$Input29 = GUICtrlCreateInput("0", 344, 152, 49, 21)
	$Input30 = GUICtrlCreateInput("0", 400, 152, 49, 21)
	$Input31 = GUICtrlCreateInput("0", 456, 152, 49, 21)
	$Input32 = GUICtrlCreateInput("0", 512, 152, 49, 21)
	$Input33 = GUICtrlCreateInput("0", 568, 152, 49, 21)
	$Input34 = GUICtrlCreateInput("0", 8, 200, 49, 21)
    GUISetState()
EndFunc   ;==>gui2
;---------------------------------------------------------	
	
Func On_Close_Main()
    Exit
EndFunc   ;==>On_Close_Main
;---------------------------------------------------------

Func On_Close_Secondary()
    GUIDelete($g_hGUI2)
EndFunc   ;==>On_Close_Secondary
;---------------------------------------------------------

Func On_Checkbox1()
    If _IsChecked(@GUI_CtrlId) Then
        gui2()
    Else
        On_Close_Secondary()
    EndIf
EndFunc   ;==>On_Button2
;---------------------------------------------------------

Func _IsChecked($idControlID)
    Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED
EndFunc   ;==>_IsChecked
;---------------------------------------------------------

Func calculate()
    Local $calcAP = GUICtrlRead($ap)
    Local $calcBP = GUICtrlRead($bp)
    Local $calcXP = GUICtrlRead($xp)
	
    Local $f
    Local $arr[12] = ["helm", "zbroja", "spodnie"]

	For $i = 0 To UBound($arr) - 1
        $f = @ScriptDir & "\eq\" & $arr[$i] & ".ini"
	    Switch $arr[$i]
            Case "helm"
                $readcombo = GUICtrlRead($Combo1)
            Case "zbroja"
                $readcombo = GUICtrlRead($Combo2)
            Case "spodnie"
                $readcombo = GUICtrlRead($Combo3)
        EndSwitch
	    $calcHP = Execute($calcAP & IniRead($f, $readcombo, "AP", "+0"))
        $calcMP = Execute($calcBP & IniRead($f, $readcombo, "BP", "+0"))
        $calcXP = Execute($calcXP & IniRead($f, $readcombo, "XP", "+0"))
	Next
	
	MsgBox(0, "Calculated", "AP: " & $calcHP & @CRLF & _
                            "BP: " & $calcMP & @CRLF & _
                            "XP: " & $calcXP )
	EndFunc   ;==>calculate
;---------------------------------------------------------

 

Opublikowano
9 godzin temu, Skayblas napisał:

miałeś wadliwą obsługę zdarzeń. w ogóle dziwnie jest zrobiona więc pozmieniałem trochę. wygląda na to że teraz działa


#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <WinAPIFiles.au3>
;--------------------------------------------------------

    $hGUI1 = GUICreate("SymStat", 215, 650, 100, 45)
	GUISetState(@SW_SHOW)
    $Group1 = GUICtrlCreateGroup("Statystyki", 8, 8, 201, 265)
	$ap = GUICtrlCreateInput("200", 90, 40, 105, 21)
	$bp = GUICtrlCreateInput("200", 90, 72, 105, 21)
	$xp = GUICtrlCreateInput("200", 90, 104, 105, 21)
	
	$Label1 = GUICtrlCreateLabel("AP", 16, 48, 70, 17)
	$Label2 = GUICtrlCreateLabel("BP", 16, 80, 70, 17)
	$Label3 = GUICtrlCreateLabel("XP", 16, 112, 70, 17)
	
	GUICtrlCreateGroup("", -99, -99, 1, 1)
	$Group2 = GUICtrlCreateGroup("Ekwipunek", 8, 280, 201, 313)
	$Combo1 = GUICtrlCreateCombo("Wybierz Item", 88, 296, 105, 25, BitOR($CBS_DROPDOWNLIST, $CBS_DROPDOWN, $CBS_AUTOHSCROLL))
	$Combo2 = GUICtrlCreateCombo("Wybierz Item", 88, 320, 105, 25, BitOR($CBS_DROPDOWNLIST, $CBS_DROPDOWN, $CBS_AUTOHSCROLL))
	$Label8 = GUICtrlCreateLabel("HELM", 16, 304, 70, 17)
	$Label9 = GUICtrlCreateLabel("ZBROJA", 16, 328, 70, 17)
	$Combo3 = GUICtrlCreateCombo("Wybierz Item", 88, 344, 105, 25, BitOR($CBS_DROPDOWNLIST, $CBS_DROPDOWN, $CBS_AUTOHSCROLL))
	$Combo4 = GUICtrlCreateCombo("Wybierz Item", 88, 368, 105, 25, BitOR($CBS_DROPDOWNLIST, $CBS_DROPDOWN, $CBS_AUTOHSCROLL))
	$Combo5 = GUICtrlCreateCombo("Wybierz Item", 88, 392, 105, 25, BitOR($CBS_DROPDOWNLIST, $CBS_DROPDOWN, $CBS_AUTOHSCROLL))
	$Combo6 = GUICtrlCreateCombo("Wybierz Item", 88, 416, 105, 25, BitOR($CBS_DROPDOWNLIST, $CBS_DROPDOWN, $CBS_AUTOHSCROLL))
	$Combo7 = GUICtrlCreateCombo("Wybierz Item", 88, 440, 105, 25, BitOR($CBS_DROPDOWNLIST, $CBS_DROPDOWN, $CBS_AUTOHSCROLL))
	$Combo8 = GUICtrlCreateCombo("Wybierz Item", 88, 464, 105, 25, BitOR($CBS_DROPDOWNLIST, $CBS_DROPDOWN, $CBS_AUTOHSCROLL))
	$Combo9 = GUICtrlCreateCombo("Wybierz Item", 88, 488, 105, 25, BitOR($CBS_DROPDOWNLIST, $CBS_DROPDOWN, $CBS_AUTOHSCROLL))
	$Combo10 = GUICtrlCreateCombo("Wybierz Item", 88, 512, 105, 25, BitOR($CBS_DROPDOWNLIST, $CBS_DROPDOWN, $CBS_AUTOHSCROLL))
	$Combo11 = GUICtrlCreateCombo("Wybierz Item", 88, 536, 105, 25, BitOR($CBS_DROPDOWNLIST, $CBS_DROPDOWN, $CBS_AUTOHSCROLL))
	$Combo12 = GUICtrlCreateCombo("Wybierz Item", 88, 560, 105, 25, BitOR($CBS_DROPDOWNLIST, $CBS_DROPDOWN, $CBS_AUTOHSCROLL))
	$Label10 = GUICtrlCreateLabel("SPODNIE", 16, 352, 70, 17)
	$Button1 = GUICtrlCreateButton("KALKULUJ", 16, 600, 75, 41, $WS_GROUP)
	Local $idCheckBox1 = GUICtrlCreateCheckbox("Sklepowki", 120, 600, 75, 41)
;----------------------------------------------------------------------------

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $Button1
            calculate()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd
;--------------------------------------------------------------------------

Func gui2()
	$g_hGUI2 = GUICreate("Sklepowe Przedmioty", 624, 629, 330, 55)
	GUISetOnEvent($GUI_EVENT_CLOSE, "On_Close_Secondary") ; Run this function when the secondary GUI [X] is clicked
	$Helmet = GUICtrlCreateLabel(">> Helm <<", 8, 32, 100, 17)
	$Input1 = GUICtrlCreateInput("0", 8, 56, 49, 21)
	$ZYCIE = GUICtrlCreateLabel("AP", 16, 8, 35, 17, $SS_CENTER)
	$Label1 = GUICtrlCreateLabel("BP", 72, 8, 35, 17, $SS_CENTER)
	$Input2 = GUICtrlCreateInput("0", 64, 56, 49, 21)
	$KONDA = GUICtrlCreateLabel("XP", 120, 8, 42, 17, $SS_CENTER)
	$Input3 = GUICtrlCreateInput("0", 120, 56, 49, 21)
	$Input4 = GUICtrlCreateInput("0", 176, 56, 49, 21)
	$Input5 = GUICtrlCreateInput("0", 232, 56, 49, 21)
	$Input6 = GUICtrlCreateInput("0", 288, 56, 49, 21)
	$Input7 = GUICtrlCreateInput("0", 344, 56, 49, 21)
	$Input8 = GUICtrlCreateInput("0", 400, 56, 49, 21)
	$Input9 = GUICtrlCreateInput("0", 456, 56, 49, 21)
	$Input10 = GUICtrlCreateInput("0", 512, 56, 49, 21)
	$Input11 = GUICtrlCreateInput("0", 568, 56, 49, 21)
	$Input12 = GUICtrlCreateInput("0", 8, 104, 49, 21)
	$Label10 = GUICtrlCreateLabel(">> Zbroja <<", 8, 80, 100, 17)
	$Input13 = GUICtrlCreateInput("0", 64, 104, 49, 21)
	$Input14 = GUICtrlCreateInput("0", 120, 104, 49, 21)
	$Input15 = GUICtrlCreateInput("0", 176, 104, 49, 21)
	$Input16 = GUICtrlCreateInput("0", 232, 104, 49, 21)
	$Input17 = GUICtrlCreateInput("0", 288, 104, 49, 21)
	$Input18 = GUICtrlCreateInput("0", 344, 104, 49, 21)
	$Input19 = GUICtrlCreateInput("0", 400, 104, 49, 21)
	$Input20 = GUICtrlCreateInput("0", 456, 104, 49, 21)
	$Input21 = GUICtrlCreateInput("0", 512, 104, 49, 21)
	$Input22 = GUICtrlCreateInput("0", 568, 104, 49, 21)
	$Input23 = GUICtrlCreateInput("0", 8, 152, 49, 21)
	$Label11 = GUICtrlCreateLabel(">> Spodnie <<", 8, 128, 100, 17)
	$Input24 = GUICtrlCreateInput("0", 64, 152, 49, 21)
	$Input25 = GUICtrlCreateInput("0", 120, 152, 49, 21)
	$Input26 = GUICtrlCreateInput("0", 176, 152, 49, 21)
	$Input27 = GUICtrlCreateInput("0", 232, 152, 49, 21)
	$Input28 = GUICtrlCreateInput("0", 288, 152, 49, 21)
	$Input29 = GUICtrlCreateInput("0", 344, 152, 49, 21)
	$Input30 = GUICtrlCreateInput("0", 400, 152, 49, 21)
	$Input31 = GUICtrlCreateInput("0", 456, 152, 49, 21)
	$Input32 = GUICtrlCreateInput("0", 512, 152, 49, 21)
	$Input33 = GUICtrlCreateInput("0", 568, 152, 49, 21)
	$Input34 = GUICtrlCreateInput("0", 8, 200, 49, 21)
    GUISetState()
EndFunc   ;==>gui2
;---------------------------------------------------------	
	
Func On_Close_Main()
    Exit
EndFunc   ;==>On_Close_Main
;---------------------------------------------------------

Func On_Close_Secondary()
    GUIDelete($g_hGUI2)
EndFunc   ;==>On_Close_Secondary
;---------------------------------------------------------

Func On_Checkbox1()
    If _IsChecked(@GUI_CtrlId) Then
        gui2()
    Else
        On_Close_Secondary()
    EndIf
EndFunc   ;==>On_Button2
;---------------------------------------------------------

Func _IsChecked($idControlID)
    Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED
EndFunc   ;==>_IsChecked
;---------------------------------------------------------

Func calculate()
    Local $calcAP = GUICtrlRead($ap)
    Local $calcBP = GUICtrlRead($bp)
    Local $calcXP = GUICtrlRead($xp)
	
    Local $f
    Local $arr[12] = ["helm", "zbroja", "spodnie"]

	For $i = 0 To UBound($arr) - 1
        $f = @ScriptDir & "\eq\" & $arr[$i] & ".ini"
	    Switch $arr[$i]
            Case "helm"
                $readcombo = GUICtrlRead($Combo1)
            Case "zbroja"
                $readcombo = GUICtrlRead($Combo2)
            Case "spodnie"
                $readcombo = GUICtrlRead($Combo3)
        EndSwitch
	    $calcHP = Execute($calcAP & IniRead($f, $readcombo, "AP", "+0"))
        $calcMP = Execute($calcBP & IniRead($f, $readcombo, "BP", "+0"))
        $calcXP = Execute($calcXP & IniRead($f, $readcombo, "XP", "+0"))
	Next
	
	MsgBox(0, "Calculated", "AP: " & $calcHP & @CRLF & _
                            "BP: " & $calcMP & @CRLF & _
                            "XP: " & $calcXP )
	EndFunc   ;==>calculate
;---------------------------------------------------------

 

Nie działa, usunąłeś wszystkie zmienne od gui przez co się w ogóle nie odpala. 

10 20 | 30 | 40 | 50 | 60 | 70 | 80 | 90 | 100 | 200 | 300 400 | 500 | 600 | 700 | 800 | 900 | 1000logoskillowcy.png

 

Opublikowano

Ten kod jest poprawny. Wszystko działa w ISN AutoIT Studio. Szukając przyczyny dla czego nie działałby u ciebie, spróbowałem go zkompliwać w SciTE. Rzeczywiście tam nie działa. Trzeba przerobić obsługę drugiego gui analogicznie jak zrobiłem wczesniej. ALe szybciej ci wyjdzie zainstalowanie autoit studia.

Opublikowano

Nie chce instalować dodatkowych programów, czekam może ktoś pomoże.

10 20 | 30 | 40 | 50 | 60 | 70 | 80 | 90 | 100 | 200 | 300 400 | 500 | 600 | 700 | 800 | 900 | 1000logoskillowcy.png

 

Zarchiwizowany

Ten temat przebywa obecnie w archiwum. Dodawanie nowych odpowiedzi zostało zablokowane.

×
×
  • Dodaj nową pozycję...