Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
How to call out the keyboard in Imgui under Android — Gideros Forum

How to call out the keyboard in Imgui under Android

i cannot call out the keyboard when i use "inputText",how to fix it?

------------------------------------------------------------------------------
require "ImGui"

local imgui = ImGui.new()
stage:addChild(imgui)

local window01 = true
local text = "my text"

function onEnterFrame(e)
-- 1 we start ImGui
imgui:newFrame(e.deltaTime)
-- 2 we add some child windows and build our GUI
window01 = imgui:beginWindow("Window 01") -- no close button (X)
if window01 then -- the variable is false when window is collapsed
imgui:text("Hello Dear ImGui!")
local isChanged = false
text, isChanged = imgui:inputText("text", text, 300, 0)
if isChanged then print(text) end
end
-- 3 we end the frame and render to screen
imgui:endFrame()
imgui:render()
end

stage:addEventListener(Event.ENTER_FRAME, onEnterFrame)

Comments

  • MoKaLuxMoKaLux Member
    edited September 20 Accepted Answer
    I have this code for you to try, it adds an imgui button to open/close the android keyboard.
    require "ImGui"
     
    local imgui = ImGui.new()
    -- imgui font
    local imguiio = imgui:getIO()
    local fontatlas = imguiio:getFonts()
    local myfont = fontatlas:addFont("fonts/Cabin-Regular-TTF.ttf", 36) -- your custom font here
    imguiio:setFontDefault(myfont)
    fontatlas:build()
    -- boolean to show android kb
    local showandroidkb = false
     
    stage:addChild(imgui)
     
    local text = "my text"
     
    function onEnterFrame(e)
    	-- 1 we start ImGui
    	imgui:newFrame(e.deltaTime)
    	-- 2 we add some child windows and build our GUI
    	if imgui:beginWindow("Window 01") then
    		imgui:text("Hello Dear ImGui!")
    		local isChanged = false
    		text, isChanged = imgui:inputText("text", text, 2^8, 0)
    		if isChanged then
    			print(text)
    		end
    		if imgui:button("show kb") then
    			showandroidkb = not showandroidkb
    			application:setKeyboardVisibility(showandroidkb)
    		end
    	end
    	-- 3 we end the frame and render to screen
    	imgui:endFrame()
    	imgui:render()
    end
     
    stage:addEventListener(Event.ENTER_FRAME, onEnterFrame)
    Delete key was not working for me so to enter new text highlight the whole text and then type your new text.
    my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
  • MoKaLuxMoKaLux Member
    Accepted Answer
    FYI: gideros player apk updated to gideros 2021.11 https://github.com/mokalux/gideros-player-for-android
    my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
  • MoKaLux said:

    FYI: gideros player apk updated to gideros 2021.11

    thanks

    Likes: MoKaLux

    +1 -1 (+1 / -0 )Share on Facebook
Sign In or Register to comment.