[WIN] setFocus() to SLE on keyPressing PushButton
- Posted by chris bensler <bensler at MailOps.Com> Jan 20, 2001
- 485 views
In my app that I'm writing, i want the user to be able to enter text in the SLE, then press the hotkey for a Pushbutton and have it return focus to the SLE again. I've been trying, but to no avail. onKeyPress switches focus to the said PushButton, I try to have it set the focus back to the SLE, but it doesn't seem to do anything.. here is the code in question... -- BEGIN CODE SNIPPET -- procedure Add_Word() sequence TheWord TheWord = getText(WGWords_Combo) for i = 1 to length(TheWord) do if TheWord[i] <'A' or TheWord[i] >'z' or TheWord[i] >'z' and TheWord[i] <'a' then TheWord = "" exit end if end for if not find(TheWord,WORD_LIST) and not equal(TheWord,"") and not equal (TheWord," - WORD LIST - ") then WORD_LIST &= {TheWord} NumWords = length(WORD_LIST) ListSize = NumWords*20+20 if ListSize > 200 then ListSize = 200 end if setSize(WGWords_Combo,202,ListSize) addItem(WGWords_Combo,WORD_LIST[NumWords]) setText(WGWords_Combo," - WORD LIST - ") setFocus(WGWords_Combo) end if end procedure onClick[ WGAdd_But ] = routine_id("Add_Word") procedure onKPress_WGAdd_But(integer KeyCode, integer Mask) if KeyCode = 13 then Add_Word() end if end procedure onKeyPress[ WGAdd_But ] = routine_id("onKPress_WGAdd_But") -- END CODE SNIPPET -- Chris ________________________________________________________________