Jump to content

Msgbox Buton Yazılarını Değiştirmek


MostWanted

Recommended Posts

Local $ChangeText[4] = ['', 'Deneme1', 'Deneme2', 'Deneme3']
$iMsg = _MsgBoxEx(3, '??', 'tnctr', 0, $ChangeText)
MsgBox(64, 'Info', 'The Return Was: ' & $iMsg)

Func _MsgBoxEx($iFlag, $sTitle, $sText, $iTime = 0, $sCIDChange = '')
    Local $_MsgBox_ = '"' & "ConsoleWrite(MsgBox(" & $iFlag & ', ""' & $sTitle & '"", ""' & $sText & '"", ' & $iTime & '"))'
    Local $iPID = Run(@AutoItExe & ' /AutoIt3ExecuteLine ' & $_MsgBox_, '', @SW_SHOW, 6)
    Do
        Sleep(10)
    Until WinExists($sTitle)
    If IsArray($sCIDChange) Then
        For $iCC = 1 To UBound($sCIDChange) - 1
            ControlSetText($sTitle, '', 'Button' & $iCC, $sCIDChange[$iCC])
        Next
    Else
        ControlSetText($sTitle, '', 'Button1', $sCIDChange)
    EndIf
    While ProcessExists($iPID)
        Local $iStdOut = StdoutRead($iPID)
        If Number($iStdOut) Then Return $iStdOut
        Sleep(10)
    WEnd
    If IsArray($sCIDChange) Then Return SetError(1, 0, 2)
    Return SetError(1, 0, 1)
EndFunc[/CODE]

Yine küçük güzel bi örnek..Autoit forumlarından..

Link to comment
Share on other sites

  • 2 ay sonra...

Demek istediğim mesaj için bir gui tasarlayıp onu kullanabilirsin. Yani guide icon, label,button olacak.

Bak sade bir örnek verim, anlarsın...

Tabi çok farklı şekilde bu mesaj ekranını özelleştirebilir ve function içinde yazdığın için çalışmanın çeşitli yerlerinde kullanabilirsin.

$iMsgBoxAnswer = _Blue_MsgBox("BlueLife MsgBox", "Merhaba dünya!")
Select
	Case $iMsgBoxAnswer = 6 ;Yes

	Case $iMsgBoxAnswer = 7 ;No

	Case $iMsgBoxAnswer = 2 ;Cancel

EndSelect

Func _Blue_MsgBox($sTitle, $sText, $iTime = 0, $Hwnd = "")
	Local $ReturCode = 2
	Local $MSG_Form = GUICreate($sTitle, 350, 85, -1, -1)
	Local $MSG_ICON = GUICtrlCreateIcon("shell32.dll", 1001, 10, 10, 32, 32)
	Local $MSG_LABEL = GUICtrlCreateLabel($sText,45,10,300,30,0x001)
	GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
	GUICtrlSetColor(-1, 0x0000FF)
	Local $MSG_BTN1 = GUICtrlCreateButton("Evet", 10, 55, 160, 23)
	Local $MSG_BTN2 = GUICtrlCreateButton("Hayır", 180, 55, 160, 23)
	GUISetState(@SW_SHOW)
	While 1
		$nMsg = GUIGetMsg()
		Switch $nMsg
			Case -3
				$ReturCode = 2 ;Iptal
				ExitLoop
			Case $MSG_BTN1
				$ReturCode = 6 ;Evet
				ExitLoop
			Case $MSG_BTN2
				$ReturCode = 7 ;Hayır
				ExitLoop
		EndSwitch
	WEnd
	GUIDelete($MSG_Form)
	Return $ReturCode
EndFunc

Link to comment
Share on other sites

Hocam bende zaten buna benzer bi çalışma yaptım ama

Ana Sahneden MsgBox Gui'sini çalıştırdığım zaman Seçeneklerden birini çalıştırıp MsgBox Gui'sini kapattıramadım

GuiDelete deniyordum oluyordu fakat bu sefer Ana GUI' üzerindeki fonksiyonlar çalışmıyordu

Exit kodunu verdirdiğim zaman ise bütün GUI'lerden çıkıyordu

O Yüzden buraya sorduğum soruyu yazmak zorunda kaldım

Link to comment
Share on other sites

evet Exitloop ile istediğim oldu ama

Hala da Ana GUI'deki fonksiyonlar etkin olmuyor

Onun için ne yapmam Lazım

Şöyle söylim

Ana sahnedeki Butona bastırıp şu msgbox Gui'sini getirtiyorum

GuiDelete ile msgBox Gui'sini sildirip exitloop ile kapattırıyorum

Ama Ana sahnedeki butonu

GuiCtrLSetState ile tekrardan etkin hale getiremiyorum

ya da Ana sahneye koyduğum kapat butonunu etkin hale getiremiyorum

Link to comment
Share on other sites

@Dj Demir

Fazla bir şey anlamadım! Anlatmak istediğini örnek vererek anlatırsan daha iyi olur!

$Form1 = GUICreate("Form1", 405, 155, 192, 124)
$Button1 = GUICtrlCreateButton("Button1", 16, 88, 163, 25)
$Button2 = GUICtrlCreateButton("Button1", 201, 91, 163, 25)
GUISetState(@SW_SHOW)
While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case -3
			Exit

		Case $Button1
			_Blue_MsgBox("Buton 1", "Birinci butona basıldı",0,$Form1)

		Case $Button2
			_Blue_MsgBox("Buton 2", "Ikinci butona basıldı",0,$Form1)

	EndSwitch
WEnd

Func _Blue_MsgBox($sTitle, $sText, $iTime = 0, $Hwnd = "")
	If $Hwnd <> "" Then GUISetState(@SW_DISABLE,$Hwnd)
	Local $ReturCode = 2
	Local $MSG_Form = GUICreate($sTitle, 350, 85, -1, -1,BitOR(0x80880000, 0x00C00000), 0x00000010,$Hwnd)
	Local $MSG_ICON = GUICtrlCreateIcon("shell32.dll", 1001, 10, 10, 32, 32)
	Local $MSG_LABEL = GUICtrlCreateLabel($sText,45,10,300,30,0x001)
	GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
	GUICtrlSetColor(-1, 0x0000FF)
	Local $MSG_BTN1 = GUICtrlCreateButton("Evet", 10, 55, 160, 23)
	Local $MSG_BTN2 = GUICtrlCreateButton("Hayır", 180, 55, 160, 23)
	GUISetState(@SW_SHOW)
	While 1
		$nMsg = GUIGetMsg()
		Switch $nMsg
			Case -3
				$ReturCode = 2 ;Iptal
				ExitLoop
			Case $MSG_BTN1
				$ReturCode = 6 ;Evet
				ExitLoop
			Case $MSG_BTN2
				$ReturCode = 7 ;Hayır
				ExitLoop
		EndSwitch
	WEnd
	If $Hwnd <> "" Then GUISetState(@SW_ENABLE,$Hwnd)
	GUIDelete($MSG_Form)
	Return $ReturCode
EndFunc

Link to comment
Share on other sites

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Form1", 331, 150, 222, 137)
$Button = GUICtrlCreateButton("BUTTON", 80, 56, 137, 33, $WS_GROUP)
GUISetState(@SW_SHOW)


While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
  Case $Button
   GUICtrlSetState($Button , $GUI_DISABLE)
   _MsgBox()

EndSwitch
WEnd


Func _MsgBox()

$MsgBox = GUICreate("Form1", 401, 125, 291, 225)
$Button2 = GUICtrlCreateButton("TIKLA", 130, 55, 137, 33, $WS_GROUP)
GUISetState(@SW_SHOW)


While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $Button2
   GUIDelete($MsgBox)
   _MsgBoxtaki_Butona_Basildiginda_Cikan_Yer()
;~    GuiCtrLsetState($Button , $GUI_ENABLE)===>bunu şuraya da koyunca oldu .
    ExitLoop
  EndSwitch
WEnd
EndFunc

Func _MsgBoxtaki_Butona_Basildiginda_Cikan_Yer()

$Msg = GUICreate("Form1", 400, 200, -1,-1)
$KAPAT = GUICtrlCreateButton("KAPAT", 130, 55, 137, 33, $WS_GROUP)
GUISetState(@SW_SHOW)


While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $KAPAT
  Local $Button,$MsgBox
  GUIDelete($MsgBox)
   GuiCtrlSetState($Button , $GUI_ENABLE);işte bu 3.Gui'yi kapattıktan sonra ilk gui tekrar eski haline gelmiyor , demek istediğim buydu
   ExitLoop

EndSwitch
WEnd
EndFunc

Demek istediğim buydu

Ama sorunumu çözdüm

hatanın nerede olduğunu da scriptte yazdım

Link to comment
Share on other sites

Evet ama en alttaki fonksiyona yazdığım zaman olmuyordu

Sonra bir öncekine yazmayı denedim Çalıştı :)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...