MostWanted Posted August 10, 2011 Share Posted August 10, 2011 (edited) Baktım son günlerimizin popüler sorusu 2 gui kullanmak.Genelde de "Hakkında" kısmı yapmak için kullanılıyor fakat ben biraz daha detaylı olarak iciği ciciği anlatmaya çalışacağım.İlk önce içinde bir tane buton olan bir gui oluşturalım. [code]#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("Örnek", 440, 332) $hButtonTikla = GUICtrlCreateButton("Tıkla Bana! ", 112, 152, 201, 41) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $hButtonTikla ;Buraya hakkında guimizi koyacağız. EndSwitch WEnd [/code] Evet guimizi oluşturduktan sonra bir de "Hakkında" guimizi oluşturalım. [code] $hHakkindaGui = GUICreate("Hakkında", 334, 269) $GroupBox1 = GUICtrlCreateGroup("", 8, 8, 305, 185) GUICtrlCreatePic("", 16, 24, 105, 97) GUICtrlCreateLabel("Product Name", 152, 24, 72, 17) GUICtrlCreateLabel("Version", 152, 48, 39, 17) GUICtrlCreateLabel("Comments", 16, 160, 53, 17) GUICtrlCreateLabel("Copyright", 16, 136, 48, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $hButtonKapat = GUICtrlCreateButton("&OK", 124, 208, 75, 25, 0) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd[/code] Hazır Kodadaki guiyi aldım değişme yapmadım.Şimdi hikaye kısmını bitirip kodlarımızı yazmaya başlayalım.İlk önce bir kaç fonksiyonu tanıtmak istiyorum. [b][u]GUISetState ;[/u][/b] bu fonksiyon ile guimizi istediğimiz gibi evirip çevirebiliyoruz Yani şöyle istersek tıklanabilir istersek tıklanamaz istersek görünür istersek görünmez yapabiliyoruz.Bu elimizde dursun [u][b]GuiDelete ;[/b][/u] İngilizcesi az olan birisi bile elimizdeki guiyi yok etmeyi yani silmeye yaradığını anlayabilir [b][u]exitloop;[/u][/b] bu bir fonksiyon değil fakat yine de anlatmak da fayda var.Bu komut bizi içinde bulunduğumuz while döngüsünden çıkartmaya yarıyor.2 gui yaparken herkesi en büyük sorunlarından birisini çözüyor diyebiliriz. Şimdi guimizi birleştirelim.Üstüne de kapatma kodunu da yazalım. [code]#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("Örnek", 440, 332) $hButtonTikla = GUICtrlCreateButton("Tıkla Bana! ", 112, 152, 201, 41) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $hButtonTikla $hHakkindaGui = GUICreate("Hakkında", 334, 269, -1, -1,-1,-1, $hGUI) ; -1'ler default değeri parametre olarak yollar.En sona yazdığımız $hGUI ise bu guinin diğer guinin içinde olduğunu belirtmek için ;Eğer yapmazsanız görev çubuğunda farklı bi gui olarak gözükür.Tercihiniz tabiki elzem bir şey değil. ;~ $hHakkindaGui = GUICreate("Hakkında", 334, 269) Böyle de yapabilirsiniz. $GroupBox1 = GUICtrlCreateGroup("", 8, 8, 305, 185) GUICtrlCreatePic("", 16, 24, 105, 97) GUICtrlCreateLabel("Product Name", 152, 24, 72, 17) GUICtrlCreateLabel("Version", 152, 48, 39, 17) GUICtrlCreateLabel("Comments", 16, 160, 53, 17) GUICtrlCreateLabel("Copyright", 16, 136, 48, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $hButtonKapat = GUICtrlCreateButton("&OK", 124, 208, 75, 25, 0) GUISetState(@SW_SHOW, $hHakkindaGui) GUISetState(@SW_DISABLE, $hGUI) ;İlk guimizi tıklanamaz hale getirir.Bu döngüde olduğumuz için görev yapamayacağından yapmamız gerekir. While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $hButtonKapat ; virgülle ayırdığımızda hakkında guisinde hem çarpıya tıkladığında hemde ok butonuna tıkladığında aynı işlevi yapar. GUIDelete($hHakkindaGui) GUISetState(@SW_ENABLE, $hGUI) ; Ana guiyi tekrar aktif hale getirir. ExitLoop EndSwitch WEnd EndSwitch WEnd [/code] Kodların olabildiğince yanlarına açıklamasını yazdım.Kolay gelsin. Edited August 10, 2011 by MostWanted Quote Link to comment Share on other sites More sharing options...
Mehmet Posted August 10, 2011 Share Posted August 10, 2011 @MostWanted eline sağlık çok açıklayıcı birde senin bu örneğe şifreli giriş eklermisin ve girişte $a=InputBox("Doğrulama","Şifreyi Giriniz","","*")kısmında ok,cancel değilde tamam iptal nasıl yapcaz. Quote Link to comment Share on other sites More sharing options...
MostWanted Posted August 10, 2011 Author Share Posted August 10, 2011 (edited) Burda 2 gui ile çalışmayı anlattım.Şifre koyma işini de iftardan sonra anlatırım artık.Zor bir şey değil aslında ama Edited August 10, 2011 by MostWanted Quote Link to comment Share on other sites More sharing options...
Mehmet Posted August 10, 2011 Share Posted August 10, 2011 (edited) Benim konuya kimse cevap vermeyince Hakkında kısmını bir MsgBox ile çare buldum Case $About MsgBox(0, "Hakkında", "TNCTR", 3) 3 saniyede kapanıyor Edited August 10, 2011 by mehmetben Quote Link to comment Share on other sites More sharing options...
Mehmet Posted November 8, 2011 Share Posted November 8, 2011 GUISetState(@SW_DISABLE, $Form1)bu kod controlHover fonksiyonunu devre dışı bırakıyor GUISetState(@SW_ENABLE, $Form1) gibi tekrar ilk ana guimize dündüğümüzde controlHover fonksiyonun çalışması için ne yapmalıyım Quote Link to comment Share on other sites More sharing options...
kamuran731 Posted December 11, 2011 Share Posted December 11, 2011 Anlatım çok güzel teşekkür ederim. özellikler yanlara yazılan açıklamalar çok aydınlatıcı. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.