Что нового

[Элементы GUI] Корректное закрытие окна Dummy

ZeVSalt

Я не лупоглазый, это прищур такой !
Сообщения
136
Репутация
0
Добрый день!
Объясните пожалуйста как корректно закрыть окно вызванное по GUICtrlCreateDummy из основного окна.
Дочернее окно вызывается нажатием кнопки из основного окна, при закрытии окна Dummy закрывается и основное окно, как сделать чтобы закрывалось ТОЛЬКО дочернее окно, а основное оставалось открытым?
 

kaster

Мой Аватар, он лучший самый
Команда форума
Глобальный модератор
Сообщения
4,020
Репутация
626
ZeVSalt
GUICtrlCreateDummy не то что окно, даже элемент не создает. как можно догадаться из названия это пустой элемент, исключительно для отлова сигналов от скрипта. покажи код. а вообще, есть уже куча тем про дочерние окна. пользуйся поиском
 
Автор
ZeVSalt

ZeVSalt

Я не лупоглазый, это прищур такой !
Сообщения
136
Репутация
0
Вот часть скрипта, что нужно изменить?
подскажите пож-ста.
или может вообще отказаться от Dummy?

Код:
#include <Encoding.au3>
#include <Array.au3>
#include <GUIConstants.au3>
#include <GuiStatusBar.au3>



#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("EVE-Calculator v.2.2", 305, 320, 193, 125)

$Label1 = GUICtrlCreateLabel("Оборудование станции %", 10, 10, 130, 20)
$Stand = GUICtrlCreateInput("50", 150, 10, 130, 20) ; Оборудование станции

$Label2 = GUICtrlCreateLabel("Refining", 10, 40, 130, 20)
$Refining = GUICtrlCreateCombo("", 150, 40, 130, 20) ; Refining
GUICtrlSetData(-1,"0|1|2|3|4|5","0")

$Label3 = GUICtrlCreateLabel("Refinery Efficiency", 10, 70, 130, 20)
$Refinery_E = GUICtrlCreateCombo("", 150, 70, 130, 20) ; Refinery Efficiency
GUICtrlSetData(-1,"0|1|2|3|4|5","0")

$Label12 = GUICtrlCreateLabel("Ore_Processing", 10, 100, 130, 20)
$Ore_Processing = GUICtrlCreateCombo("", 150, 100, 130, 20) ; Ore_Processing
GUICtrlSetData(-1,"0|1|2|3","0")

$Label12 = GUICtrlCreateLabel("Комиссионные завода", 10, 130, 130, 20)
$Stand_npc = GUICtrlCreateInput("5", 150, 130, 130, 20) ; Standing NPC

$Label4 = GUICtrlCreateLabel("Руда", 10, 160, 130, 20)
$ORE = GUICtrlCreateCombo("", 150, 160, 130, 20)
GUICtrlSetData(-1,"Arkonor|Azure Plagioclase|Bistot|Bright Spodumain|Concentrated_Veldspar|Condensed Scordite|Crimson Arkonor|Crokite|Crystalline Crokite|Dark Ochre|Dense Veldspar|Fiery Kernite|Glazed Hedbergite|Gleaming Spodumain|Gneiss|Golden Omber|Hedbergite|Hemorphite|Iridescent Gneiss|Jaspet|Kernite|Luminous Kernite|Magma Mercoxit|Massive Scordite|Mercoxit|Monoclinic Bistot|Obsidian Ochre|Omber|Onyx Ochre|Plagioclase|Prime Arkonor|Prismatic Gneiss|Pristine Jaspet|Pure Jaspet|Pyroxeres|Radiant Hemorphite|Rich Plagioclase|Scordite|Sharp Crokite|Solid Pyroxeres|Spodumain|Triclinic Bistot|Veldspar|Viscous Pyroxeres|Vitreous Mercoxit|Vitric Hedbergite|Vivid Hemorphite", "Veldspar")

$Label5 = GUICtrlCreateLabel("Колличество руды", 10, 190, 130, 20)
$ORE_col = GUICtrlCreateInput("1000", 150, 190, 130, 20) ; Колличество руды


$Button1 = GUICtrlCreateButton("Расчитать", 10, 220, 280, 30, 0)
$Button2 = GUICtrlCreateButton("Показать цены в Jita", 10, 260, 280, 30, 0)


GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		 Case $GUI_EVENT_CLOSE
			Exit
		 Case $Button1 
			Push_Button1()
		 Case $Button2
			Push_Button2 ()
	EndSwitch
WEnd


Func Push_Button1()
   
$Calc = GUICreate("Расчет минералов",300,300, 100,200)
GUISetBkColor (0xE8E8E8)  
$StatusBar = _GUICtrlStatusBar_Create($Calc)

Dim $StatusBar_PartsWidth[1] = [-1]
_GUICtrlStatusBar_SetParts($StatusBar, $StatusBar_PartsWidth)
$user = GUICtrlCreateDummy()
$button = GUICtrlCreateButton ("OK",120,250,70,20)
GUISetState()

$Isogen = GUICtrlCreateLabel("Isogen", 10, 10, 40, 20)
$Megacyte = GUICtrlCreateLabel("Megacyte", 10, 30, 40, 20)
$Mexalon = GUICtrlCreateLabel("Mexalon", 10, 50, 40, 20)
$Morphite= GUICtrlCreateLabel("Morphite", 10, 70, 40, 20)
$Nocxium = GUICtrlCreateLabel("Nocxium", 10, 90, 40, 20)
$Pyerite = GUICtrlCreateLabel("Pyerite", 10, 110, 40, 20)
$Tritanium = GUICtrlCreateLabel("Tritanium", 10, 130, 40, 20)
$Zydrine = GUICtrlCreateLabel("Zydrine",10, 150, 40, 20)
$Itogo_MIN = GUICtrlCreateLabel("ИТОГО МИНЕРАЛЫ :", 10, 180, 200, 20)
$Itogo_ORE = GUICtrlCreateLabel("ИТОГО РУДА :", 10, 210, 200, 20)
;~ $cena = GUICtrlCreateLabel ("цена")

$Isog_col = GUICtrlCreateLabel("0", 150, 10, 40, 20);Isogen
$Mega_col = GUICtrlCreateLabel("0", 150, 30, 40, 20);Megacyte
$Mexa_col = GUICtrlCreateLabel("0", 150, 50, 40, 20);Mexalon
$Morp_col = GUICtrlCreateLabel("0", 150, 70, 40, 20);Morphite
$Nocx_col = GUICtrlCreateLabel("0", 150, 90, 40, 20);Nocxium
$Pyer_col = GUICtrlCreateLabel("0", 150, 110, 40, 20);Pyerite
$Trit_col = GUICtrlCreateLabel("0", 150, 130, 40, 20);Tritanium
$Zydr_col = GUICtrlCreateLabel("0", 150, 150, 40, 20);Zydrine

$Isog_obh = GUICtrlCreateLabel("0", 220, 10, 60, 20);Isogen цена общая
$Mega_obh = GUICtrlCreateLabel("0", 220, 30, 60, 20);Megacyte цена общая
$Mexa_obh = GUICtrlCreateLabel("0", 220, 50, 60, 20);Mexalon цена общая
$Morp_obh = GUICtrlCreateLabel("0", 220, 70, 60, 20);Morphite цена общая
$Nocx_obh = GUICtrlCreateLabel("0", 220, 90, 60, 20);Nocxium цена общая
$Pyer_obh = GUICtrlCreateLabel("0", 220, 110, 60, 20);Pyerite цена общая
$Trit_obh = GUICtrlCreateLabel("0", 220, 130, 60, 20);Tritanium цена общая
$Zydr_obh = GUICtrlCreateLabel("0", 220, 150, 60, 20);Zydrine цена общая
$Mine_obh = GUICtrlCreateLabel("0", 220, 180, 60, 20);ИТОГО МИНЕРАЛЫ
$ORE__obh = GUICtrlCreateLabel("0", 220, 210, 60, 20);ИТОГО РУДА

_GUICtrlStatusBar_SetText($StatusBar, "Ждите...", 0)

;~ --------- расчет стендинга

$Standing = (GUICtrlRead($Stand)+37.5*(1+GUICtrlRead($Refining)*0.02)*(1+GUICtrlRead($Refinery_E)*0.04)*(1+GUICtrlRead($Ore_Processing)*0.05))/100
;~ (Эффективность работы станции) + 0.375  x (1 + [Навык Refining] x 0.02) x (1 + [Навык Refinery Efficiency] x 0.04) x (1 + [Навык Ore Processing] x 0.05) =  Количество минералов

  ;~    --------------- расчет Vitreous Mercoxit

Case  GUICtrlRead($ORE) = "Vitreous Mercoxit" 
   $Const_ORE = Floor (GUICtrlRead($ORE_col)/250)
   
   $Const_mining_Tritanium = 0
   $Const_mining_Pyerite = 0
   $Const_mining_Mexalon = 0
   $Const_mining_Isogen = 0
   $Const_mining_Nocxium = 0
   $Const_mining_Zydrine = 0
   $Const_mining_Megacyte = 0
   $Const_mining_Nritanium = 0
   $Const_mining_Morphite = 583
   
   $Tritanium_ideal = $Const_mining_Tritanium*$Const_ORE*$Standing
   $Tritanium_NPC = $Tritanium_ideal * GUICtrlRead($Stand_npc)/100
   $Tritanium = $Tritanium_ideal - $Tritanium_NPC
   $TRI_Sum = Round ((PastingMAX(34) * $Tritanium), 2)
   
GUICtrlSetData($Trit_col, Ceiling ($Tritanium))
GUICtrlSetData($Trit_obh, $TRI_Sum)
   
   $Pyerite_ideal = $Const_mining_Pyerite*$Const_ORE*$Standing
   $Pyerite_NPC = $Pyerite_ideal * GUICtrlRead($Stand_npc)/100
   $Pyerite = $Pyerite_ideal - $Pyerite_NPC
   $Pyer_Sum = Round ((PastingMAX(34) * $Pyerite), 2)

GUICtrlSetData($Pyer_col, Ceiling ($Pyerite))
GUICtrlSetData($Pyer_obh, $Pyer_Sum)

   $Mexalon_ideal = $Const_mining_Mexalon*$Const_ORE*$Standing
   $Mexalon_NPC = $Mexalon_ideal * GUICtrlRead($Stand_npc)/100
   $Mexalon = $Mexalon_ideal - $Mexalon_NPC
   $Mexa_Sum = Round ((PastingMAX(34) * $Mexalon), 2)

GUICtrlSetData($Mexa_col, Ceiling ($Mexalon))
GUICtrlSetData($Mexa_obh, $Mexa_Sum)

$Isogen_ideal = $Const_mining_Isogen*$Const_ORE*$Standing
   $Isogen_NPC = $Isogen_ideal * GUICtrlRead($Stand_npc)/100
   $Isogen = $Isogen_ideal - $Isogen_NPC
   $Isog_Sum = Round ((PastingMAX(34) * $Isogen), 2)

GUICtrlSetData($Isog_col, Ceiling ($Isogen))
GUICtrlSetData($Isog_obh, $Isog_Sum)

$Nocxium_ideal = $Const_mining_Nocxium*$Const_ORE*$Standing
   $Nocxium_NPC = $Nocxium_ideal * GUICtrlRead($Stand_npc)/100
   $Nocxium = $Nocxium_ideal - $Nocxium_NPC
   $Nocx_Sum = Round ((PastingMAX(34) * $Nocxium), 2)

GUICtrlSetData($Nocx_col, Ceiling ($Nocxium))
GUICtrlSetData($Nocx_obh, $Nocx_Sum)

$Zydrine_ideal = $Const_mining_Zydrine*$Const_ORE*$Standing
   $Zydrine_NPC = $Zydrine_ideal * GUICtrlRead($Stand_npc)/100
   $Zydrine = $Zydrine_ideal - $Zydrine_NPC
   $Zydr_Sum = Round ((PastingMAX(34) * $Zydrine), 2)

GUICtrlSetData($Zydr_col, Ceiling ($Zydrine))
GUICtrlSetData($Zydr_obh, $Zydr_Sum)

$Megacyte_ideal = $Const_mining_Megacyte*$Const_ORE*$Standing
   $Megacyte_NPC = $Megacyte_ideal * GUICtrlRead($Stand_npc)/100
   $Megacyte = $Megacyte_ideal - $Megacyte_NPC
   $Mega_Sum = Round ((PastingMAX(34) * $Megacyte), 2)

GUICtrlSetData($Mega_col, Ceiling ($Megacyte))
GUICtrlSetData($Mega_obh, $Mega_Sum)

$Morphite_ideal = $Const_mining_Morphite*$Const_ORE*$Standing
   $Morphite_NPC = $Morphite_ideal * GUICtrlRead($Stand_npc)/100
   $Morphite = $Morphite_ideal - $Morphite_NPC
   $Morp_Sum = Round ((PastingMAX(34) * $Morphite), 2)

GUICtrlSetData($Morp_col, Ceiling ($Morphite))
GUICtrlSetData($Morp_obh, $Morp_Sum)


EndSelect


   $Mine_Sum = (GUICtrlRead($Isog_obh)) + (GUICtrlRead($Mega_obh)) + (GUICtrlRead($Mexa_obh)) + (GUICtrlRead($Morp_obh)) + (GUICtrlRead($Nocx_obh)) + (GUICtrlRead($Pyer_obh)) + (GUICtrlRead($Trit_obh)) + (GUICtrlRead($Zydr_obh))
GUICtrlSetData($Mine_obh, $Mine_Sum)
    ConsoleWrite($TRI_Sum)
   _GUICtrlStatusBar_SetText($StatusBar, "OK", 0)
   Do
  $msg = GUIGetMsg ()
     
   Select
      Case $msg = $button
         GUICtrlSendToDummy($user)
      Case $msg = $user
         ; special action before closing
         ; ...
         exit
   EndSelect
Until $msg = $GUI_EVENT_CLOSE
EndFunc

Func Push_Button2 ()
   
$Prise = GUICreate("Цены в Jita",200,220, 100,200)
GUISetBkColor (0xE8E8E8)  ; will change background color
$StatusBar = _GUICtrlStatusBar_Create($Prise)
Dim $StatusBar_PartsWidth[1] = [-1]
_GUICtrlStatusBar_SetParts($StatusBar, $StatusBar_PartsWidth)
$user = GUICtrlCreateDummy()
$button = GUICtrlCreateButton ("OK",65,170,70,20)
GUISetState()

$Isogen = GUICtrlCreateLabel("Isogen", 10, 10, 40, 20)
$Megacyte = GUICtrlCreateLabel("Megacyte", 10, 30, 40, 20)
$Mexalon = GUICtrlCreateLabel("Mexalon", 10, 50, 40, 20)
$Morphite= GUICtrlCreateLabel("Morphite", 10, 70, 40, 20)
$Nocxium = GUICtrlCreateLabel("Nocxium", 10, 90, 40, 20)
$Pyerite = GUICtrlCreateLabel("Pyerite", 10, 110, 40, 20)
$Tritanium = GUICtrlCreateLabel("Tritanium", 10, 130, 40, 20)
$Zydrine = GUICtrlCreateLabel("Zydrine",10, 150, 40, 20)


$Isog_ed = GUICtrlCreateLabel("", 100, 10, 40, 20);Isogen цена за единицу
$Mega_ed = GUICtrlCreateLabel("", 100, 30, 40, 20);Megacyte цена за единицу
$Mexa_ed = GUICtrlCreateLabel("", 100, 50, 40, 20);Mexalon цена за единицу
$Morp_ed = GUICtrlCreateLabel("", 100, 70, 40, 20);Morphite цена за единицу
$Nocx_ed = GUICtrlCreateLabel("", 100, 90, 40, 20);Nocxium цена за единицу
$Pyer_ed = GUICtrlCreateLabel("", 100, 110, 40, 20);Pyerite цена за единицу
$Trit_ed = GUICtrlCreateLabel("", 100, 130, 40, 20);Tritanium цена за единицу
$Zydr_ed = GUICtrlCreateLabel("", 100, 150, 40, 20);Zydrine цена за единицу

_GUICtrlStatusBar_SetText($StatusBar, "Ждите...", 0)

   GUICtrlSetData($Trit_ed, PastingMAX(34));Tritanium
   GUICtrlSetData($Pyer_ed, PastingMAX(35));Pyerite
   GUICtrlSetData($Mexa_ed, PastingMAX(36));Mexallon
   GUICtrlSetData($Isog_ed, PastingMAX(37));Isogen
   GUICtrlSetData($Nocx_ed, PastingMAX(38));Nocxium
   GUICtrlSetData($Zydr_ed, PastingMAX(39));Zydrine
   GUICtrlSetData($Mega_ed, PastingMAX(40));Megacyte
   GUICtrlSetData($Morp_ed, PastingMAX(11399));Morphite
_GUICtrlStatusBar_SetText($StatusBar, "OK", 0)
Do
  $msg = GUIGetMsg ()
     
   Select
      Case $msg = $button
         GUICtrlSendToDummy($user)
      Case $msg = $user
         ; special action before closing
         ; ...
         exit
   EndSelect
Until $msg = $GUI_EVENT_CLOSE

EndFunc
Func PastingMAX($id_type)
   $S_Inet = "http://api.eve-central.com/api/marketstat?typeid="&$id_type&"&regionlimit=10000002&usesystem=30000142"
   Local $sData1 = InetRead($S_Inet)
	  $sString1 = _Encoding_UTF8ToANSI(BinaryToString($sData1))
	  $sPattern1 = '(?s).*?<type id=["'']*(.*?)["'']*>.*?<buy>.*?<max>(.*?)</max>.*?'
	  $StringR = StringRegExp($sString1, $sPattern1, 3)
	  Return $StringR[1]
EndFunc
 
Верх