MikiiTakagi Posted August 15, 2019 Share Posted August 15, 2019 I was wondering the best practice for having multiple UI. I looked into the wiki to see how to do multiple UI but I think it could be done way better... I have about 5 different form and in each form I change the property of label and such. Right now i noticed that I need to set the variable at the begin of the program with dummy value to be able to change it later. I have about 50 variable now at the begin of my program. It working fine but i was just wondering if there is a better way to do it :S. expandcollapse popup;Set Static Dummy Variable #Region Global $frmWindowsMenu = 9999, $frmMaitreDMenu = 9999, $frmRetailMenu = 9999,$frmLBossMenu = 9999, $frmWintecPrint = 9999 Global $OSArchi = 9999 Global $lblFirewallEtat = 9998, $btnFirewall = 9998 Global $lblUACEtat = 9998, $btnUAC = 9998 Global $lblDirCom = 9998, $btnDirCom = 9998 Global $lblIPv6Etat = 9998, $btnIPv6 = 9998 Global $lblSleepNetworkEtat = 9998, $btnSleepNetwork = 9998 Global $lblVersion = 9997, $lblLicense = 9997 Global $lblDoubleLicenseEtat = 9997, $btnDoubleLicense = 9997 Global $lblSlogTxtEtat = 9997, $btnSlogTxt = 9997 Global $lblCryptKeyEtat = 9997, $btnCryptKey = 9997 Global $lblBOSrvEtat = 9997, $btnBOSrv = 9997 Global $lblWindowsLogonEtat = 9997, $btnWindowsLogon = 9997 Global $lblNocommeEtat = 9997, $btnNocomme = 9997 Global $lblCRQEEtat = 9997, $btnCRQE = 9997 Global $lblTempWindowsEtat = 9996, $btnTempWindows = 9996 Global $btn_2400 = 9995, $btn_4800 = 9995, $btn_9600 = 9995, $btn_19200 = 9995, $btn_38400 = 9995, $btn_57600 = 9995, $btn_115200 = 9995 Global $btnAutoDetectCom = 9995, $btn_com1 = 9995, $btn_com2 = 9995, $btn_com3 = 9995, $btn_com4 = 9995, $btn_com5 = 9995, $btn_com6 = 9995, $btn_com7 = 9995 Global $btn_change2400 = 9995, $btn_change4800 = 9995, $btn_change9600 = 9995, $btn_change19200 = 9995, $btn_change38400 = 9995, $btn_change57600 = 9995, $btn_change115200 = 9995 Global $btn_testPrint = 9995, $btn_changeDensity1 = 9995, $btn_changeDensity2 = 9995, $btn_changeDensity3 = 9995, $btn_feedCut = 9995, $btn_disableChinese = 9995 ;Print Dummy Variable Global $aBaudRate[7] $aBaudRate[0] = 2400 $aBaudRate[1] = 4800 $aBaudRate[2] = 9600 $aBaudRate[3] = 19200 $aBaudRate[4] = 38400 $aBaudRate[5] = 57600 $aBaudRate[6] = 115200 Global $sportSetError = '' Global $CMPort = 1 ; Port Global $CmBoBaud = 115200 ; Baud Global $CmboDataBits = 8 ; Data Bits Global $CmBoParity = "none" ; Parity Global $CmBoStop = 1 ; Stop Global $setflow = 2 ; Flow Global $RTSMode = 1 Global $DTRMode = 1 Global $iWait = 0 #EndRegion Sry for my bad english it is my second language. Any advice is welcome :P. Link to comment Share on other sites More sharing options...
jchd Posted August 15, 2019 Share Posted August 15, 2019 What are all those 9999, 9998, ... "dummy values" for? Your question isn't explicit at all. BTW you can use a more compact style: Global $aBaudRate = [2400, 4800, 9600, 19200, 38400, 57600, 115200] This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
MikiiTakagi Posted August 15, 2019 Author Share Posted August 15, 2019 Ohhh That would same some space! If i dont put something in the variable i run into some problem so i just put 9999 inside and switch for each form(instead of the same everywhere) so i can keep that which form that variable is linked to. Link to comment Share on other sites More sharing options...
jchd Posted August 15, 2019 Share Posted August 15, 2019 Still clear as mud. Can you post [short] runnable code showing the kind of problem you run into by not initializing all the values with dummy integers? This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
MikiiTakagi Posted August 15, 2019 Author Share Posted August 15, 2019 (edited) I need to go right now i have a convention to go :S Will send that the fastest i can! i have 1200 lines in my project so im gonna try to make it simple to reproduce the problem! Big thanks for the help! Edited August 15, 2019 by MikiiTakagi Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 15, 2019 Moderators Share Posted August 15, 2019 MikiiTakagi & jchd, I imagine the OP are basing his code on the Managing Multiple GUIs tutorial in the Wiki. As such you need these place holders ONLY if the control is being referenced within the GUIGetMsg loop of your script - this is to prevent the control Case being fired when there is no return from GUIGetMsg. This "No Event" return is 0 - as is the value of a non-assigned variable - and so would result in the Case code being actioned on every pass. Using a place holder prevents this as this arbitrarily large value is never returned by GUIGetMsg. So you should be able to reduce your problem by ONLY assigning placeholder values to those variables referenced within your idle loop. Another solution is to create all your GUIs at the beginning of the script and use GUISetState to hide/show them as required - that way all the controls are automatically assigned valid ControlIDs and the problem no longer exists. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
MikiiTakagi Posted August 20, 2019 Author Share Posted August 20, 2019 Exactly! thanks for the info. I just found out i can actually split my code into multiple au3 file. I started doing it and everyone works fine and easier to work with! Setting variable at the beginning of each file it needed make it so much easier to read! Link to comment Share on other sites More sharing options...
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