Shao Posted September 1, 2008 Posted September 1, 2008 Hello,I try to display an edit in a tab's page but it looks to be refreshing for ever. Can you tell me what's wrong with my script, please ?Thank you.CODEFunc main_gui() $return = "continue"$main_gui = GUICreate($Soft_Name, $DesktopWidth, $DesktopHeight, 0, 0, BitOR($WS_CLIPSIBLINGS, $WS_OVERLAPPEDWINDOW, $WS_MAXIMIZE), $WS_EX_CLIENTEDGE) ; ************* ; BARRE DE MENU ; ************* $mi_options = GUICtrlCreateMenu($m_Options) $mi_statistiques = GUICtrlCreateMenu($m_Statistics, $mi_options) $mi_stat_ouvrir = GUICtrlCreateMenuItem($m_Ouvrir, $mi_statistiques) $mi_recherches = GUICtrlCreateMenu($m_Recherches, $mi_options) $mi_rech_ouvrir = GUICtrlCreateMenuItem($m_Ouvrir, $mi_recherches) $mi_rech_enregistrer = GUICtrlCreateMenuItem($m_Enregistrer, $mi_recherches) GUICtrlCreateMenuItem("", $mi_options) $mi_exercises = GUICtrlCreateMenuItem($m_Exercises, $mi_options) GUICtrlCreateMenuItem("", $mi_options) $mi_close = GUICtrlCreateMenuItem($m_Close, $mi_options) $mi_parametres = GUICtrlCreateMenu($m_Parametres) $mi_langue = GUICtrlCreateMenu($m_Langue, $mi_parametres) $mi_francais = GUICtrlCreateMenuItem($m_Francais, $mi_langue) $mi_english = GUICtrlCreateMenuItem($m_English, $mi_langue) GUICtrlCreateMenuItem("", $mi_parametres) $mi_administration = GUICtrlCreateMenu($m_Administration, $mi_parametres) $mi_preferences = GUICtrlCreateMenuitem($m_Preferences, $mi_administration, 1) ; ******* ; BOUTONS ; ******* ; définition des variables de positionnement des boutons et contrôles $ButtonWidth = 960 $LeftButton = ($DesktopWidth-$ButtonWidth)/2 ; Exercices $b_exercises = GUICtrlCreateButton($m_Exercices, $LeftButton, 30, 120, 25, 0) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") ; Dictionnaire $g_translation = GUICtrlCreateGroup($m_Traduction, $LeftButton+120+100, 25, 740, 50) ; From $l_de = GUICtrlCreateLabel($m_De, $LeftButton+220+25, 45, 25, 20, $SS_RIGHT) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $c_lang1 = GUICtrlCreateCombo($ini_Languages[1], $LeftButton+270+15, 45, 97, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetData(-1, $ini_Languages[2], $ini_Languages[1]) ; To $l_en = GUICtrlCreateLabel($m_En, $LeftButton+382+30, 45, 25, 20, $SS_RIGHT) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $c_lang2 = GUICtrlCreateCombo($ini_Languages[1], $LeftButton+437+15, 45, 97, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetData(-1, $ini_Languages[2], $ini_Languages[2]) ; Mots à rechercher $l_word = GUICtrlCreateLabel($m_Mots, $LeftButton+549+50, 45, 55, 20, $SS_RIGHT) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $i_word = GUICtrlCreateInput("", $LeftButton+654+10, 45, 200, 21, BitOR($ES_AUTOHSCROLL, $ES_MULTILINE)) ; Rechercher $b_search = GUICtrlCreateButton($m_Chercher, $LeftButton+864+10, 45, 55, 20, 0) ; donner le focus à la barre de recherche ControlFocus($main_gui, "", $i_word) ; ************* ; PAGE CENTRALE ; ************* ; définition des variables de positionnement et de dimensions de l'éditeur ; l'éditeur et l'onglet se positionnent dans la fenêtre en s'ajustant à la résolution d'écran $EditWidth = $DesktopWidth *0.90 $Left = ($DesktopWidth-$EditWidth) /2 $EditHeight = ($DesktopHeight -85)*0.85 $Top = 85 +( ($DesktopHeight -85)-$EditHeight ) /2 $TabTop = $Top-20 $Editor = GUICtrlCreateTab ($Left+2, $TabTop, $EditWidth, $EditHeight+40) $EditorLexique = GUICtrlCreateTabItem(" " & $m_Lexique) $g_page = GUICtrlCreateEdit("", $Left, $Top, $EditWidth, $EditHeight, BitOR($ES_AUTOVSCROLL, $WS_VSCROLL, $ES_READONLY)) GUICtrlSetBkColor(-1, 0xa09bb8) GUISetState(@SW_SHOW) While 1 $mainMsg = GUIGetMsg() Switch $mainMsg ; *********************** ; CAS DE LA BARRE DE MENU ; *********************** Case $mi_close $play = 0 ExitLoop Case $mi_preferences settings_gui() ContinueLoop Case $mi_francais IniWrite($ini_Settings, "langues", "défaut", "Français") $play = 1 ExitLoop Case $mi_english IniWrite($ini_Settings, "langues", "défaut", "English") $play = 1 ExitLoop Case $mi_exercises Edit_Cleaner() Exercices("continue") ContinueLoop Case $mi_stat_ouvrir Local $c_Number, $TotalReponses, $BonnesReponses, $TR_Taux, $BR_Taux, $epreuves_lignes, $erreurs_lignes stat_read($c_Number, $TotalReponses, $BonnesReponses, $TR_Taux, $BR_Taux, $epreuves_lignes, $erreurs_lignes) StatDisplay($c_Number, $TotalReponses, $BonnesReponses, $TR_Taux, $BR_Taux, 1, $epreuves_lignes, $erreurs_lignes) ContinueLoop Case $mi_rech_ouvrir rech_read() ContinueLoop Case $mi_rech_enregistrer rech_record() ContinueLoop ; ************************ ; CAS DES CONTROLES DU GUI ; ************************ Case $GUI_EVENT_CLOSE $play = 0 ExitLoop Case $b_exercises Edit_Cleaner() Exercices("continue") ContinueLoop Case $b_search Entree() ContinueLoop Case $b_close_edit Edit_Cleaner() ContinueLoop EndSwitch WEnd GUIDelete($main_gui)EndFunc----------------Now playing: Orchestral Manoeuvres in the Dark - Was It Something I Saidvia FoxyTunes
Zedna Posted September 1, 2008 Posted September 1, 2008 Example from AutoIt helpfile for GUICtrlCreateTabItem() expandcollapse popup#include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) Example() Func Example() Local $tab, $tab0, $tab0OK, $tab0input Local $tab1, $tab1combo, $tab1OK Local $tab2, $tab2OK, $msg GUICreate("My GUI Tab", 250, 150); will create a dialog box that when displayed is centered GUISetBkColor(0x00E0FFFF) GUISetFont(9, 300) $tab = GUICtrlCreateTab(10, 10, 200, 100) $tab0 = GUICtrlCreateTabItem("tab0") GUICtrlCreateLabel("label0", 30, 80, 50, 20) $tab0OK = GUICtrlCreateButton("OK0", 20, 50, 50, 20) $tab0input = GUICtrlCreateInput("default", 80, 50, 70, 20) $tab1 = GUICtrlCreateTabItem("tab----1") GUICtrlCreateLabel("label1", 30, 80, 50, 20) $tab1combo = GUICtrlCreateCombo("", 20, 50, 60, 120) GUICtrlSetData(-1, "Trids|CyberSlug|Larry|Jon|Tylo", "Jon"); default Jon $tab1OK = GUICtrlCreateButton("OK1", 80, 50, 50, 20) $tab2 = GUICtrlCreateTabItem("tab2") GUICtrlSetState(-1, $GUI_SHOW); will be display first GUICtrlCreateLabel("label2", 30, 80, 50, 20) $tab2OK = GUICtrlCreateButton("OK2", 140, 50, 50) GUICtrlCreateTabItem(""); end tabitem definition GUICtrlCreateLabel("Click on tab and see the title", 20, 130, 250, 20) GUISetState() ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $tab Then ; display the clicked tab WinSetTitle("My GUI Tab", "", "My GUI Tab" & GUICtrlRead($tab)) EndIf WEnd EndFunc ;==>Example It looks like you missed GUICtrlCreateTabItem(""); end tabitem definition Resources UDF ResourcesEx UDF AutoIt Forum Search
Shao Posted September 1, 2008 Author Posted September 1, 2008 It looks like you missed GUICtrlCreateTabItem(""); end tabitem definition hello Excuseme but I didn't forget to use GUICtrlCreateTabItem. I based the creation of the tab on the helpfile of AutoIt, so I don't really understand what's wrong. CODE $Editor = GUICtrlCreateTab ($Left+2, $TabTop, $EditWidth, $EditHeight+40) $EditorLexique = GUICtrlCreateTabItem(" " & $m_Lexique) $g_page = GUICtrlCreateEdit("", $Left, $Top, $EditWidth, $EditHeight, BitOR($ES_AUTOVSCROLL, $WS_VSCROLL, $ES_READONLY)) GUICtrlSetBkColor(-1, 0xa09bb8) ---------------- Now playing: Various Artists - Doin' It - Nathan's Theme via FoxyTunes ---------------- Now playing: Various Artists - Doin' It - Nathan's Theme via FoxyTunes
Zedna Posted September 1, 2008 Posted September 1, 2008 You are wrong. Read it carefully! CODE $Editor = GUICtrlCreateTab ($Left+2, $TabTop, $EditWidth, $EditHeight+40) $EditorLexique = GUICtrlCreateTabItem(" " & $m_Lexique) $g_page = GUICtrlCreateEdit("", $Left, $Top, $EditWidth, $EditHeight, BitOR($ES_AUTOVSCROLL, $WS_VSCROLL, $ES_READONLY)) GUICtrlSetBkColor(-1, 0xa09bb8) GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) ... Resources UDF ResourcesEx UDF AutoIt Forum Search
Shao Posted September 2, 2008 Author Posted September 2, 2008 (edited) You are wrong. Read it carefully!CODE$Editor = GUICtrlCreateTab ($Left+2, $TabTop, $EditWidth, $EditHeight+40)$EditorLexique = GUICtrlCreateTabItem(" " & $m_Lexique)$g_page = GUICtrlCreateEdit("", $Left, $Top, $EditWidth, $EditHeight, BitOR($ES_AUTOVSCROLL, $WS_VSCROLL, $ES_READONLY))GUICtrlSetBkColor(-1, 0xa09bb8)GUICtrlCreateTabItem("")GUISetState(@SW_SHOW)...I added this lineCODEGUICtrlCreateTabItem(""); end tabitem definitionbut it doesn't work ; still the same problem.---------------- Edited September 2, 2008 by Shao
Shao Posted September 2, 2008 Author Posted September 2, 2008 ok, problem identified and fixed.I had forgotten to deleteCase $b_close_edit Edit_Cleaner() ContinueLoop... in Switch $mainMsg ... EndSwitch.This created a constant loop.----------------Now playing: Bob Sinclar - Love Generationvia FoxyTunes
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now