01-23-2016, 11:04 PM
(01-23-2016, 02:55 PM)clasqm Wrote: Is there a way to clear the autocomplete list? I know I can turn it off, but what if I want to clear the list and start with a new one?
I am tinkering with my text editors Trope and Rondel, feeding in a UK English wordlist for autocompletion, but what if my user suddenly decides that US English is more suitable? I can tell the user to save the file, close the editor and start over, but that is not very satisfactory. I would prefer to clear out all the UK English terms and feed in my US English (or French, or German) list.
place your textedit on a view that can be removed ( no menu or shortcuts) and remove the view, then re-add the view and textedit. This short example uses the Reset button to remove the autocomplete for the textedit.
Note: there is no code to save the text of the textedit.
Code:
#!yab
doc Place a description of your
doc program here.
doc
doc Author, date, license
// set DEBUG = 1 to print out all messages on the console
DEBUG = 0
OpenWindow()
// Main Message Loop
dim msg$(1)
while(not leavingLoop)
nCommands = token(message$, msg$(), "|")
for everyCommand = 1 to nCommands
if(DEBUG and msg$(everyCommand)<>"") print msg$(everyCommand)
switch(msg$(everyCommand))
case "_QuitRequested":
case "MainWindow1:_QuitRequested":
leavingLoop = true
break
case "Reset"
view remove "MainWindow"
view 0,0 to 500,400, "MainWindow", "MainWindow1"
TEXTEDIT 10,30 TO 490,390, "Textedit", 0, "MainWindow"
break
default:
break
end switch
next everyCommand
wend
CloseWindow()
end
// Setup the main window here
sub OpenWindow()
window open 100,100 to 600,500, "MainWindow1", "Main Window"
view 0,0 to 500,400, "MainWindow", "MainWindow1"
TEXTEDIT 10,30 TO 490,390, "Textedit", 0, "MainWindow"
TEXTEDIT set "Textedit", "autocomplete", "testing"
BUTTON 50,3 TO 100,23, "Reset", "Reset", "MainWindow"
return
end sub
// Close down the main window
sub CloseWindow()
window close "MainWindow"
return
end sub