kylomas Posted December 29, 2012 Share Posted December 29, 2012 Good Evening, When I tab to $btn020 I am expecting the <ENTER> key as well as the mouse to action this button. Only the mouse does. expandcollapse popup; *** Start added by AutoIt3Wrapper *** #include <WindowsConstants.au3> ; *** End added by AutoIt3Wrapper *** ; *** Start added by AutoIt3Wrapper *** #include <StaticConstants.au3> ; *** End added by AutoIt3Wrapper *** ; *** Start added by AutoIt3Wrapper *** #include <GUIConstantsEx.au3> ; *** End added by AutoIt3Wrapper *** ; ; generalized search engine using SQLite ; #AutoIt3Wrapper_Add_Constants=n #include <sqlite.au3> #include <array.au3> local $gui010 = guicreate('Generalized Search Engine Using SQLite',270,300) local $file = guictrlcreatemenu('&File') local $fileSRCH = guictrlcreatemenuitem('Save Search Results',$file) local $fileDB = guictrlcreatemenuitem('Save SQLite DB',$file) local $fileexit = guictrlcreatemenuitem('Exit',$file) local $help = guictrlcreatemenu('&Help') local $helptxt = guictrlcreatemenuitem('Usage',$help) local $helpabt = guictrlcreatemenuitem('About',$help) guictrlcreatelabel('Specify Input File', 030,040,300,020) guictrlsetfont(-1,9,800) local $flin = guictrlcreateinput('', 030,065,200,020) guictrlcreatelabel('Specify Delimiter Character',030,105,165,020) guictrlsetfont(-1,9,800) local $delim = guictrlcreateinput('', 210,100,020,025) guictrlsetfont(-1,10,800) local $btn020 = guictrlcreatebutton('Create / Open DB', 030,180,200,020) guictrlsetfont(-1,10,800) guictrlsetcolor(-1,0xaa0000) guictrlcreatelabel('Status', 030,230,040,020,$ss_sunken) guictrlsetfont(-1,8,800,-1,'Lucinda Console') local $status = guictrlcreatelabel('', 030,250,200,020,$SS_sunken) guictrlsetfont(-1,8.5,800) guictrlsetcolor(-1,0xaa0000) guisetstate() while 1 switch guigetmsg() case $gui_event_close Exit case $fileSRCH ;_fileSRCH() case $fileDB ;_fileDB() case $fileexit Exit case $helptxt _help() case $helpabt _about() case $flin _flin() case $delim ;_delim() case $btn020 ;_btn020() EndSwitch WEnd func _flin() if not fileexists(guictrlread($flin)) then local $fl = fileopendialog('Select a File to Process',@scriptdir, '(*.*)',1) switch @error case 1 guictrlsetdata($status,'No File Selected...try again') case 2 guictrlsetdata($status,'File Open Dialog Bad Filter') endswitch guictrlsetdata($flin,$fl) endif endfunc func _help() local $guihelp = guicreate('Help for SQLite Search Engine') local $aSize = wingetclientsize($guihelp) local $lbl010 = guictrlcreatelabel('',0,10,$aSize[1],$aSize[0],$ss_sunken) guictrlsetfont(-1,9,600) guisetstate() local $str = 'This dialog is designed to read a delimited file and populate an SQLite DB.' & @lf & @lf & 'Each record represents a row on the DB. Each delimited' $str &= ' field represents a column within a row. Any character can be specified as the delimiter.' & @lf & @LF $str &= 'Using the file menu you can save both the results of any search and/or the SQLite database.' guictrlsetdata($lbl010,$str) while 1 switch guigetmsg() case $gui_event_close guidelete($guihelp) return EndSwitch WEnd endfunc func _about() local $guihelp = guicreate('About',100,100,-1,-1,$ws_popup) local $aSize = wingetclientsize($guihelp) local $lbl010 = guictrlcreatelabel('',0,10,$aSize[1]-10,$aSize[0]-10,$ss_sunken+$ss_center) guictrlsetfont(-1,9,800,-1,'Lucinda Console') guictrlsetcolor(-1,0xaa0000) guisetstate() local $str = 'VooDooWare' & @lf & 'Version 1.0.0' & @lf & @lf & 'SQLite Generalized Search Engine' guictrlsetdata($lbl010,$str) while 1 switch guigetmsg() case $gui_event_close guidelete($guihelp) return EndSwitch WEnd endfunc kylomas Forum Rules        Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
PlayHD Posted December 29, 2012 Share Posted December 29, 2012 #include <ButtonConstants.au3> guictrlsetstyle($btn020,$BS_DEFPUSHBUTTON) OR Hotkeyset("{ENTER}","ButtonFunction") My UDF : _WinShake, _WinSplitMy Apps : Google Guitar Bot, PuzzleGameDesign Gui : Interesting Tabs Design, RBox Project (abandoned), Animated Gui on Exit Link to comment Share on other sites More sharing options...
kylomas Posted December 29, 2012 Author Share Posted December 29, 2012 PlayHD, Thank you for your response. When I add the style I can no longer tab to the button. I have never had this problem before so I think that I have something else fouled up. I do not think that the button is super-imposed with another control, but, I've been looking at this steaming pile so long that I can no longer see the forest for the trees. kylomas Forum Rules        Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
PhoenixXL Posted December 29, 2012 Share Posted December 29, 2012 (edited) GUISetAcceleratorsexpandcollapse popup; *** Start added by AutoIt3Wrapper *** #include <WindowsConstants.au3> ; *** End added by AutoIt3Wrapper *** ; *** Start added by AutoIt3Wrapper *** #include <StaticConstants.au3> ; *** End added by AutoIt3Wrapper *** ; *** Start added by AutoIt3Wrapper *** #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> ; *** End added by AutoIt3Wrapper *** ; ; generalized search engine using SQLite ; #AutoIt3Wrapper_Add_Constants=n #include <sqlite.au3> #include <array.au3> local $gui010 = guicreate('Generalized Search Engine Using SQLite',270,300) local $file = guictrlcreatemenu('&File') local $fileSRCH = guictrlcreatemenuitem('Save Search Results',$file) local $fileDB = guictrlcreatemenuitem('Save SQLite DB',$file) local $fileexit = guictrlcreatemenuitem('Exit',$file) local $help = guictrlcreatemenu('&Help') local $helptxt = guictrlcreatemenuitem('Usage',$help) local $helpabt = guictrlcreatemenuitem('About',$help) guictrlcreatelabel('Specify Input File', 030,040,300,020) guictrlsetfont(-1,9,800) local $flin = guictrlcreateinput('', 030,065,200,020) guictrlcreatelabel('Specify Delimiter Character',030,105,165,020) guictrlsetfont(-1,9,800) local $delim = guictrlcreateinput('', 210,100,020,025) guictrlsetfont(-1,10,800) local $btn020 = guictrlcreatebutton('Create / Open DB', 030,180,200,020) guictrlsetfont(-1,10,800) guictrlsetcolor(-1,0xaa0000) guictrlcreatelabel('Status', 030,230,040,020,$ss_sunken) guictrlsetfont(-1,8,800,-1,'Lucinda Console') local $status = guictrlcreatelabel('', 030,250,200,020,$SS_sunken) guictrlsetfont(-1,8.5,800) guictrlsetcolor(-1,0xaa0000) guisetstate() Local $aArray[1][2] = [['{ENTER}', $btn020]] GUISetAccelerators($aArray) while 1 switch guigetmsg() case $gui_event_close Exit case $fileSRCH ;_fileSRCH() case $fileDB ;_fileDB() case $fileexit Exit case $helptxt _help() case $helpabt _about() case $flin _flin() case $delim ;_delim() case $btn020 MsgBox( 0, 0, 'Default Button Pressed', 0, $gui010 ) ;_btn020() EndSwitch WEnd func _flin() if not fileexists(guictrlread($flin)) then local $fl = fileopendialog('Select a File to Process',@scriptdir, '(*.*)',1) switch @error case 1 guictrlsetdata($status,'No File Selected...try again') case 2 guictrlsetdata($status,'File Open Dialog Bad Filter') endswitch guictrlsetdata($flin,$fl) endif endfunc func _help() local $guihelp = guicreate('Help for SQLite Search Engine') local $aSize = wingetclientsize($guihelp) local $lbl010 = guictrlcreatelabel('',0,10,$aSize[1],$aSize[0],$ss_sunken) guictrlsetfont(-1,9,600) guisetstate() local $str = 'This dialog is designed to read a delimited file and populate an SQLite DB.' & @lf & @lf & 'Each record represents a row on the DB. Each delimited' $str &= ' field represents a column within a row. Any character can be specified as the delimiter.' & @lf & @LF $str &= 'Using the file menu you can save both the results of any search and/or the SQLite database.' guictrlsetdata($lbl010,$str) while 1 switch guigetmsg() case $gui_event_close guidelete($guihelp) return EndSwitch WEnd endfunc func _about() local $guihelp = guicreate('About',100,100,-1,-1,$ws_popup) local $aSize = wingetclientsize($guihelp) local $lbl010 = guictrlcreatelabel('',0,10,$aSize[1]-10,$aSize[0]-10,$ss_sunken+$ss_center) guictrlsetfont(-1,9,800,-1,'Lucinda Console') guictrlsetcolor(-1,0xaa0000) guisetstate() local $str = 'VooDooWare' & @lf & 'Version 1.0.0' & @lf & @lf & 'SQLite Generalized Search Engine' guictrlsetdata($lbl010,$str) while 1 switch guigetmsg() case $gui_event_close guidelete($guihelp) return EndSwitch WEnd endfunc this would even do the work, when setting the styles the previous styles are overwritten guictrlsetstyle($btn020,BitOR($BS_DEFPUSHBUTTON, $WS_TABSTOP) ) ; Do this before setting the font and color Edited December 29, 2012 by PhoenixXL My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression. Link to comment Share on other sites More sharing options...
kylomas Posted December 29, 2012 Author Share Posted December 29, 2012 (edited) PhoenixXL, Adding the styles as you suggested solved the immediate problem. However, consider this code: #include <GUIConstantsEx.au3> local $gui010 = guicreate('Button Test',100,100) local $aSize = WinGetClientSize($gui010) local $inp010 = guictrlcreateinput('Test',10,10,$aSize[1]-50,20) local $btn010 = guictrlcreatebutton('Test Button',10,$aSize[1]-30,$aSize[0]-20) guisetstate() while 1 switch guigetmsg() case $gui_event_close Exit case $btn010 ConsoleWrite('$btn010 actioned' & @LF) EndSwitch wend This is the technique that I normally follow. It does NOT have any problem and I do NOT have to apply any styles to the button. I think that your solution circumvented the problem but I still do not understand the cause of the problem. kylomas edit: just for clarity - the problem is that I cannot action the button with the <enter> key in the OP Edited December 29, 2012 by kylomas Forum Rules        Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 29, 2012 Moderators Share Posted December 29, 2012 kylomas, When I run your script from the first post I can action the button via the keyboard (when it is in focus) and mouse without any problem. I am at a loss to explain why you cannot. 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...
kylomas Posted December 29, 2012 Author Share Posted December 29, 2012 M23, Thanks, Let me copy he code I posted and try it again (...got that nervous feeling that I am about to be real embarrassed...) kylomas Forum Rules        Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
kylomas Posted December 29, 2012 Author Share Posted December 29, 2012 Same result, I cannot action the button with the <enter> key. Running current prod version of AuotIT on 64 bit WIn7. Am NOT running anything else that might be capturing the <enter> key. kylomas Forum Rules        Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 29, 2012 Moderators Share Posted December 29, 2012 kylomas,How are you detecting the action? There is nothing in the script which fires - I had to add a ConsoleWrite: case $btn020 ConsoleWrite("Hit" & @CRLF) ;_btn020()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...
kylomas Posted December 29, 2012 Author Share Posted December 29, 2012 M23, Yes, you are right, I am doing NOTHING with it in the code that I posted. Apologies to you, PhoenixXL and Jos for wasting your time! This code runs as expected expandcollapse popup; *** Start added by AutoIt3Wrapper *** #include <ButtonConstants.au3> ; *** End added by AutoIt3Wrapper *** ; *** Start added by AutoIt3Wrapper *** #include <EditConstants.au3> ; *** End added by AutoIt3Wrapper *** ; *** Start added by AutoIt3Wrapper *** #include <WindowsConstants.au3> ; *** End added by AutoIt3Wrapper *** ; *** Start added by AutoIt3Wrapper *** #include <StaticConstants.au3> ; *** End added by AutoIt3Wrapper *** ; *** Start added by AutoIt3Wrapper *** #include <GUIConstantsEx.au3> ; *** End added by AutoIt3Wrapper *** ; ; generalized search engine using SQLite ; #AutoIt3Wrapper_Add_Constants=n #include <sqlite.au3> #include <array.au3> local $gui010 = guicreate('SQLite Search Engine',260,300) local $file = guictrlcreatemenu('&File') local $fileSRCH = guictrlcreatemenuitem('Save Search Results',$file) local $fileDB = guictrlcreatemenuitem('Save SQLite DB',$file) local $fileexit = guictrlcreatemenuitem('Exit',$file) local $help = guictrlcreatemenu('&Help') local $helptxt = guictrlcreatemenuitem('Usage',$help) local $helpabt = guictrlcreatemenuitem('About',$help) guictrlcreatelabel('Specify Input File', 030,050,100,020) guictrlsetfont(-1,9,800) local $flin = guictrlcreateinput('', 030,065,200,020) guictrlcreatelabel('Specify Delimiter Character',030,105,165,020) guictrlsetfont(-1,9,800) local $delim = guictrlcreateinput('', 210,100,020,025) guictrlsetfont(-1,10,800) local $btn020 = guictrlcreatebutton('Create / Open DB', 030,180,200,020) ;guictrlsetstyle($btn020,BitOR($BS_DEFPUSHBUTTON, $WS_TABSTOP) ) guictrlsetfont(-1,10,800) guictrlsetcolor(-1,0xaa0000) guictrlcreatelabel('Status', 005,245,040,020) guictrlsetfont(-1,8,800,-1,'Lucinda Console') local $status = guictrlcreatelabel('', 005,260,250,020,$ss_sunken) guictrlsetfont(-1,8.5,800) guictrlsetcolor(-1,0xff0000) local $dmy010 = guictrlcreatedummy() guisetstate() ;~ Local $aArray[1][2] = [['{ENTER}', $dmy010]] ;~ GUISetAccelerators($aArray) while 1 switch guigetmsg() case $gui_event_close Exit case $fileSRCH ;_fileSRCH() case $fileDB ;_fileDB() case $fileexit Exit case $helptxt _help() case $helpabt _about() case $flin _flin() case $btn020 _btn020() EndSwitch WEnd func _flin() if not fileexists(guictrlread($flin)) then local $fl = fileopendialog('Select a File to Process',@scriptdir, '(*.*)',1) switch @error case 1 guictrlsetdata($status,'No File Selected...try again') case 2 guictrlsetdata($status,'File Open Dialog Bad Filter') endswitch guictrlsetdata($flin,$fl) endif endfunc func _btn020() if not fileexists(guictrlread($flin)) then local $fl = fileopendialog('Select a File to Process',@scriptdir, '(*.*)',1) switch @error case 1 guictrlsetdata($status,'No File Selected...try again') case 2 guictrlsetdata($status,'File Open Dialog Bad Filter') endswitch guictrlsetdata($flin,$fl) endif if stringlen(stringstripws(guictrlread($delim),3)) = 0 then guictrlsetdata($status,'Delimiter Character Required') guictrlsetstate($delim,$gui_focus) return endif finally_done_with_this_gui_shit_go_do_the_db() endfunc func finally_done_with_this_gui_shit_go_do_the_db() ;----------------------------------------------------------------------------- ; 1st parse the input file to a 2D array ;----------------------------------------------------------------------------- local $fl_string = fileread(guictrlread($flin)) if @error = 1 then guictrlsetdata($status,'File = ' & guictrlread($flin) & ' failed to open') Return endif local $a10 = stringsplit($fl_string,@crlf,1) guictrlsetdata($status,'Processing ' & $a10[0] & ' records') ; start load local $load_array[$a10[0]+1][2] ProgressOn('Creating Load Array','Please Wait') for $1 = 1 to $a10[0] progressset(($1/$a10[0])*100) $a20 = stringsplit($a10[$1],guictrlread($delim)) if $a20[0] > ubound($load_array,2) then redim $load_array[$a10[0]+1][$a20[0]+1] for $2 = 1 to $a20[0] $load_array[$1][$2] = $a20[$2] next next progressoff() _SQLite_Startup() if @error then ConsoleWrite('error loading sqlite.dll' & @LF) Exit EndIf local $hmemDB = _sqlite_open(guictrlread($flin) & '.db3') if @error then ConsoleWrite('Unable to open DB' & @LF) _Exit() EndIf if _sqlite_exec(-1,'drop table if exists tb1;') <> $sqlite_ok then ConsoleWrite('Drop table failed' & @LF) _exit() Else ConsoleWrite('TB1 table dropped' & @LF) endif local $sql,$aLine $sql = 'create table tb1 (' for $1 = 1 to ubound($load_array,2) $sql &= 'col' & stringformat('%03i',$1) & ',' Next $sql = stringtrimright($sql,1) $sql &= ');' if _sqlite_exec(-1,$sql) <> $sqlite_ok then ConsoleWrite('Create Table Failed ' & $sql & @LF) _exit() else ConsoleWrite('Table created as follows [' & $sql & ']' & @LF) endif ProgressOn('Loading DB','Please Wait') _SQLite_Exec(-1, "begin immediate;") for $1 = 0 to ubound($load_array) - 1 progressset(($1/(ubound($load_array)-1))*100) $sql = 'insert into tb1 values (' for $2 = 0 to ubound($load_array,2) - 1 $sql &= '"' & $load_array[$1][$2] & '",' next $sql = stringtrimright($sql,1) $sql &= ');' if _sqlite_exec(-1,$sql) <> $sqlite_ok Then ConsoleWrite('Table insert failed STMT = ' & $sql & @LF) _exit() endif next _SQLite_Exec(-1, "commit;") progressoff() guictrlsetdata($status,'DB Loaded with ' & ubound($load_array) - 1 & ' records') endfunc func _help() local $guihelp = guicreate('Help for SQLite Search Engine') local $aSize = wingetclientsize($guihelp) local $lbl010 = guictrlcreateedit('',0,10,$aSize[0],$aSize[1],$ss_sunken+$es_readonly+$ws_vscroll) guictrlsetfont(-1,9,600,-1,'courier new') guisetstate() local $str = @crlf & 'This dialog is designed to read a delimited file and populate an in memory SQLite DB.' & @crlf & @crlf & 'Each record represents a row on the DB. Each delimited' $str &= ' field represents a column within a row. Any character can be specified as the delimiter.' & @crlf & @crLF $str &= 'Using the file menu you can save both the results of any search and/or the SQLite database.' $str &= @crlf & @crlf & 'USAGE' $str &= @crlf & '-----' $str &= @crlf & @crlf & 'SPECIFY INPUT FILE' & @crlf & @crlf & 'Specify the delimited file that you want loaded to a DB for searching. If the field is left blank you will be presented with the fileopen dialog' $str &= @crlf & @crlf &'SPECIFY DELIMITER CHARACTER' & @crlf & @crlf & 'Specify the character to use as denote columns. This character will NOT appear in the data.' $str &= @crlf & @crlf &'CREATE / OPEN DB' & @crlf & @crlf & 'Start the process. If A DB corresponding to the input file name with an extension of ".DB3" exists, it will be used.' $str &= 'Otherwise a new DB will be created.' $str &= @crlf & @crlf &'MENU ITEMS' $str &= @crlf & '----------' $str &= @crlf & @crlf &'SAVE SEARCH RESULTS' & @crlf & @crlf & 'Create a .txt file of search results in the current script directory. The output file will be named the same as ' $str &= 'the input file with an incrementing 2 digit node appended to the base filename. E.G. input file = "my.txt" search file = "my01.txt", "my02.txt", etc.' $str &= @crlf & @crlf guictrlsetdata($lbl010,$str) while 1 switch guigetmsg() case $gui_event_close guidelete($guihelp) return EndSwitch WEnd endfunc func _about() local $guihelp = guicreate('About',400,100,-1,-1) local $aSize = wingetclientsize($guihelp) local $lbl010 = guictrlcreatelabel('',0,10,$aSize[0]-10,$aSize[1]-10,$ss_sunken+$ss_center) guictrlsetfont(-1,8,800,-1,'Lucinda Console') guictrlsetcolor(-1,0xaa0000) guisetstate() local $str = @crlf & 'VooDooWare' & @lf & 'Version 1.0.0' & @lf & @lf & 'SQLite Generalized Search Engine' guictrlsetdata($lbl010,$str) while 1 switch guigetmsg() case $gui_event_close guidelete($guihelp) return EndSwitch WEnd endfunc func _exit() _SQLite_Close() _SQLite_Shutdown() exit endfunc kylomas Forum Rules        Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 29, 2012 Moderators Share Posted December 29, 2012 kylomas, No problems - it happens to us all! 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...
nitekram Posted December 29, 2012 Share Posted December 29, 2012 I am not trying to hijack this thread, but got a similar question. The default wanted is - if in the GUI if I press enter, the button action hits. In the example for OP, it appears that you first have to tab to the button then you can press enter. Is it possible to have that action default - if in GUI I press enter the button action happens. I can see it happening with a HotKey, but I do not want to have the msg loop and a function to perform the same action. Thanks for your time! 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow."  WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI  CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator Link to comment Share on other sites More sharing options...
guinness Posted December 29, 2012 Share Posted December 29, 2012 Apologies to you, PhoenixXL and Jos for wasting your time!Jos? UDF List:  _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 29, 2012 Moderators Share Posted December 29, 2012 nitekram,Either create the button with the $BS_DEFPUSHBUTTON style - or use an Accelerator key (look up GUISetAccelerators). I would recommend the latter - you can then easily vary the actual control you activate with the key as the script runs, whereas with the former it is fixed. Please ask if you need any more help - although searching for scripts I have written using the functiion should give you enough to go on. 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...
PhoenixXL Posted December 29, 2012 Share Posted December 29, 2012 This is the technique that I normally follow. It does NOT have any problem and I do NOT have to apply any styles to the button. I think that your solution circumvented the problem but I still do not understand the cause of the problem.Upon creation the WS_TABSTOP style is forced and is added though not set by the user,But when the user sets the style using the GUICtrlSetStyle, there is no such circumstanceHope it clears you out My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression. Link to comment Share on other sites More sharing options...
nitekram Posted December 29, 2012 Share Posted December 29, 2012 Please ask if you need any more helpM23Thanks, I used the first option, as I only have one button, but will be looking at your examples. 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow."  WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI  CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator Link to comment Share on other sites More sharing options...
kylomas Posted December 29, 2012 Author Share Posted December 29, 2012 (edited) nitekram, Here is an example of doing exactly what you requested and M23 advised using an accelerator for the <enter> key. expandcollapse popup; *** Start added by AutoIt3Wrapper *** #include <GUIConstantsEx.au3> ; *** End added by AutoIt3Wrapper *** #include <sqlite.au3> #AutoIt3Wrapper_Add_Constants=n local $Parts_fl = @scriptdir & '\Parts.txt' local $Parts_DB = @scriptdir & '\Parts.DB3' ;------------------------------------------------------------------------------------- ; generate test file of 5,000 comma delimited items, 3 entries (cols) per line (row) ;------------------------------------------------------------------------------------- local $refresh = false if $refresh then filedelete($Parts_fl) if not fileexists($Parts_fl) then local $hfl = fileopen($Parts_fl,2) if $hfl = -1 then ConsoleWrite('File open failed' & @LF) Exit endif local $str_out for $1 = 1 to 50000 $str_out &= stringformat('%05i,M%05s,V%05s\n',$1,$1 & '-' & random(1,999,1),$1 & '-' & random(1,999,1)) Next filewrite($hfl,$str_out) fileclose($hfl) $hfl = 0 endif ;--------------------------------------------------------------------------------------- ; initialize SQLite and open Parts DB ;--------------------------------------------------------------------------------------- local $sqlstrt = _SQLite_Startup(), $st = timerinit() if @error then ConsoleWrite('error loading sqlite.dll' & @LF) Exit EndIf local $hmemDB = _sqlite_open($Parts_DB) if @error then ConsoleWrite('Unable to open DB' & @LF) _Exit() EndIf if $refresh then _reload() func _reload() if _sqlite_exec(-1,'drop table if exists parts;') <> $sqlite_ok then ConsoleWrite('Drop table failed' & @LF) _exit() Else ConsoleWrite('Parts table dropped for refresh' & @LF) endif if _sqlite_exec(-1,'create table parts (SKU, Model, Version);') <> $sqlite_ok then ConsoleWrite('Create Table Failed' & @LF) _exit() endif local $fl_array _filereadtoarray($Parts_fl,$fl_array) switch @error case 1 ConsoleWrite('Input file failed to open' & @LF) _exit() case 2 ConsoleWrite('Unable to split file' & @LF) _exit() EndSwitch local $aLine, $sql ProgressOn('Loading Parts Table','Please Wait') _SQLite_Exec(-1, "begin immediate;") for $1 = 1 to $fl_array[0] progressset(($1/$fl_array[0])*100) $aLine = stringsplit($fl_array[$1],',') $sql = 'insert into parts values (' for $2 = 1 to $aLine[0] $sql &= '"' & $aLine[$2] & '",' next $sql = stringtrimright($sql,1) $sql &= ');' if _sqlite_exec(-1,$sql) <> $sqlite_ok Then ConsoleWrite('Table insert failed STMT = ' & $sql & @LF) _exit() endif next _SQLite_Exec(-1, "commit;") progressoff() ConsoleWrite('Table loaded with ' & ubound($fl_array)- 1 & ' records in ' & round(timerdiff($st)/1000,3) & ' seconds' & @LF) endfunc ;--------------------------------------------------------------------------------------- ; display SKU query dialaog ;--------------------------------------------------------------------------------------- local $gui010 = guicreate('SKU Query Mini-APP Using SQLITE',300,170) local $aSize = wingetclientsize($gui010) guictrlcreatelabel('Enter SKU for Query',40,20,150,20) guictrlsetfont(-1,10,600) GUICtrlSetColor(-1,0xaa0000) local $inp010 = guictrlcreateinput('',190,20,40,20) local $lbl010 = guictrlcreatelabel('',70,60,250,50) guictrlsetfont(-1,10,600,-1,'Courier New') guictrlsetcolor(-1,0x000099) local $btn010 = guictrlcreatebutton('Submit Query',10,$aSize[1]-30,$aSize[0]-20,20) guictrlsetfont(-1,9,600) local $dmy010 = GUICtrlCreateDummy() guisetstate() local $aAccelKeys[1][2] = [["{ENTER}", $dmy010]] GUISetAccelerators($aAccelKeys) local $aRow, $ret while 1 switch guigetmsg() case $gui_event_close _exit() case $btn010, $dmy010 _disp() endswitch wend func _disp() $ret = _SQLite_QuerySingleRow(-1,'select SKU,Model,Version from parts where SKU = "' & stringformat('%05s',guictrlread($inp010)) & '";', $aRow) if $ret = $sqlite_ok then guictrlsetdata($lbl010,stringformat('%-10s%5s\n%-10s%5s\n%-10s%5s','SKU',$aRow[0],'Model',$aRow[1],'Version',$aRow[2])) Else guictrlsetdata($lbl010,guictrlread($inp010) & ' Not Found') endif guictrlsetstate($inp010,$gui_focus) endfunc func _exit() _SQLite_Close() _SQLite_Shutdown() exit endfunc @guiness - yes, I noticed Jos looking at the thread at some length kylomas Edited December 29, 2012 by kylomas Forum Rules        Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill 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