OsLanguage =lower (application:getLanguage ( ) ) -osLanguage="se" if osLanguage~ = "en" then local found = false local sql =db:prepare ( "PRAGMA table_info(languages) " ) if sql then for n,l in sql:urows ( ) do if l =osLanguage thenįound = true break end end end if found then local sql =db:prepare ( "SELECT en,".osLanguage. Available since: Gideros 2017.10 Class: TextField. Stage:addEventListener (Event.Local translated = pcall ( function ( ) require "lsqlite3" end )ĭst_db = "|T|retrostar.db" if file_exists (dst_db ) thenįile_copy (src_db,dst_db ) if sqlite3 then local db =sqlite3.open (dst_db,sqlite3.OPEN_READONLY ) if db then local sql =db: execute ( "PRAGMA temp_store=2 " ) ![]() MyInput:addEventListener (Event.COMPLETE, onComplete ) new imgui: setAutoUpdateCursor (true) stage: addChild (imgui) local window01 true local value 10.5 function onEnterFrame (e)- 1 we start ImGui imgui: newFrame (e)- 2 we add some child windows and build our GUI window01 imgui: beginWindow ('Window 01')- no close button (X) if window01 then- the. ![]() MyInput:setInputType (TextInputDialog.TEXT ) MyInput = TextInputDialog.new ( "Title", "Message.", "some text", "Cancel", "OK" ) If you specify nil for the font parameter while creating the TextField object, default font is used. Creates a new TextField object with the specified font and text. MyInput:setText (txt ) - THIS IS THE BUGGY PART!! CAUSES CURSOR TO JUMP BACK TO THE LEFT! Available since: Gideros 2011.6 Class: TextField Description. stage:addChild(textfield) This adds the text field to the screen. textfield:setX(10) textfield:setY(10) These set the X and Y coordinates of the bottom-left corner of the text to display on the screen. Repeat, repeat and repeat this process and finish your game without realizing it. MyInput = nil end - CONSTANTLY CHECK INPUT DIALOG TEXT function checkInput (event ) - INPUT TEXT DID NOT CHANGE? RETURN! if MyInput:getText ( ) = MyInput.lastText then return end print ( "Input text changed!" ) local txt = MyInput:getText ( ) - CHECK FOR ALLOWED CHARS local allowedChars = "0123456789abcdefABCDEF" for i = 1, txt:len ( ) do local found = false for j = 1, allowedChars:len ( ) do if txt:sub (i,i ) = allowedChars:sub (j,j ) then found = true break end end if found = false then txt = txt:sub ( 1,txt:len ( )- 1 ) end end The ‘nil’ specifies to use Gideros default font. Change your Lua code in Gideros Studio, save and test your game instantly in Gideros Player. shader binder for stride field core Avoid unecessary work when no effects are in use. color tags in text now accept style references core/textfield getTextPositionFromPoint now returns the line number also. MyInput:removeEventListener (Event.COMPLETE, onComplete ) New features, improvements and bug fixes as usual. Stage:removeEventListener (Event.ENTER_FRAME, checkInput ) INPUT COMPLETE function onComplete (event ) ![]() If I would remove the invalid characters AFTER the user pressed the OK button, he would be suprised while his text suddenly changed and some characters disappeared. ![]() sfx to your project, then double-click it to edit, click 'Save' in the editor to save the. The first of the add-on's is a '.sfx' file editor to make really small sound files that you can use in your games. However, you NEED to check an input text while the user is typing, not afterwards. Add-ons are self contained Gideros applications that can be used to enhance the main Studio Editor. So when the user types some text and I have to remove an invalid char and copy the corrected string back into the dialog box using :setText(), the cursor jumps right to beginning of the input text, which is extremely annoying for the user, especially because he does not know WHY this happened now. The problem is that the cursor is set to the beginning (LEFT side of the input text field), each time you are using inputTextdialog:setText() -just test it on an Android device (it does NOT happen on the PC). Regarding the orientation issue: WHAT line do we have to edit exactly in the AndroidManifest.xml? And where can I find this file? I did a search in my Android SDK directory and four or five files named AndroidManifest.xml popped up -so which one is the right no, I do not check the input once every frame, the text correction only triggers when the dialog box has changed, of course, so that's not the problem.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |