newText,enterPressed=ui:inputText("##licence",text,80,ImGui.InputTextFlags_CharsUppercase|ImGui.InputTextFlags_CharsNoBlank|ImGui.InputTextFlags_EnterReturnsTrue)if newText~=text then
It changes the action of the second value to a true if enter is pressed rather than isChanged. To check if changed just compare the returned string with the old one.
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
@keszegh Do you know how to set the keyboard focus to a particular inputText ?
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
@keszegh Also, do you have a more complete example of the context menu. I couldn't get that to work.
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
@keszegh Also, do you have a more complete example of the context menu. I couldn't get that to work.
if you mean a right-click context menu then i do it this way:
if imgui:button("mybutt",80)thenend
imgui:openPopupContextItem("popup", ImGui.PopupFlags_MouseButtonRight)if(imgui:beginPopupContextItem("popup"))then
result,selected=imgui:selectable("do this and that")if selected thenend
imgui:endPopup()end
i've changed the names and left empty then end parts where you can trigger actions. this works also for text etc instead of a button i think, just change the the first line accordingly.
my learning method with imgui is still a lot of trial and even more error so take my advices with this in mind, i wouldn't say i have a good overview of the api, i just do things one by one until they work as i want.
one thing about popups that e.g. it never worked directly from inside a menu for me. there is some trickery with stack if openPopup and beginPopup have the same id but it is still not working, in which case it's better to only set a value first and later at the right place (outside of menu building e.g.) check this value to openPopup and make the beginPopup right after, it's explained well here: https://www.gitmemory.com/issue/ocornut/imgui/331/751372071
@rrraptor , see in the attached image the demo window is clipped for some reason. perhaps when resizing the window one has to reinitialize imgui rendering too?
so let me know how to do it, although i guess you've modified the source code to achieve that and so i need to wait for the next version. it's fun that on the main imgui github page i'm still trying to explain what i want and try to be taken seriously while you've already done it. that's what i call gideros forum-style help. thanks
Yes, the source code is modified a bit Added 3 lines and custom widget to display plain text in menu bar. Should I add this to the final build?
@rrraptor , see in the attached image the demo window is clipped for some reason. perhaps when resizing the window one has to reinitialize imgui rendering too?
You need to change ImGui DisplaySize:
function TestScene:onAppResize()local minX, minY, maxX, maxY = application:getLogicalBounds()-- ignore scaling if neededlocal sx = application:getLogicalScaleX()local sy = application:getLogicalScaleY()
self.imgui:setScale(1/ sx, 1/ sy)-- move UI to top left corner
self.imgui:setPosition(minX, minY)-- resize display arealocal IO = self.imgui:getIO()
IO:setDisplaySize((maxX - minX)* sx, (maxY - minY)* sy)end
for the menu+titlebar combo yes please add this to the final build. then i guess what i see on your gif is a menubar, and you used some additional trick to make it grabbable like a titlebar, so please share that code bit too at some point.
I have created a small application for work that receives some information from our server. It works perfectly on my PC, but on other PCs I see "?" Instead of symbols and spaces.
And here some words have their first letters cut off, and the numbers in the calendar are missing.
@hgy29 any thoughts? Neither my PC nor the PC on which the screenshots were taken has external GPU.
for the menu+titlebar combo yes please add this to the final build. then i guess what i see on your gif is a menubar, and you used some additional trick to make it grabbable like a titlebar, so please share that code bit too at some point.
@rrraptor , about the titlebar menubar combo ocornut also made an attempt:https://github.com/ocornut/imgui/issues/4258 which looks also good but due to hard to spot issues it is likely that it won't end up in a release version. nevertheless i'd be really happy to have this feature.
btw as an alternative, if i could set the width of the 'top' menu bar (MainMenuBar), i.e. so that it does not go all the way to the right, that would also give me a partial workaround for this issue. would that be simpler to do? i can see one solution to have two imgui items, one only for this mainmenubar clipped to the size i want, and another imgui item for all the rest of the windows. but perhaps there is a nicer solution. being able to move around that mainmenubar as if it would be its own titlebar would also be good of course.
@rrraptor , about the titlebar menubar combo ocornut also made an attempt:https://github.com/ocornut/imgui/issues/4258 which looks also good but due to hard to spot issues it is likely that it won't end up in a release version. nevertheless i'd be really happy to have this feature.
btw as an alternative, if i could set the width of the 'top' menu bar (MainMenuBar), i.e. so that it does not go all the way to the right, that would also give me a partial workaround for this issue. would that be simpler to do?
ImGui:openPopupOnItemClick does not seem to exist contrary to the docs. (it seems to me that ImGui:openPopupContextItem is obsolete and this is supposed to be its replacement)
hi @rrraptor , i'm trying to do a confirm save dialog window, my issue is with setting keyboard focus.
this works fine:
if imgui:beginPopupModal("Save",nil,ImGui.WindowFlags_NoResize)thenif imgui:isWindowAppearing()then imgui:setKeyboardFocusHere()endlocal text,flag=imgui:inputText(".txt", "filename",32, ImGui.InputTextFlags_EnterReturnsTrue|ImGui.InputTextFlags_AutoSelectAll)
but if i want to put a text before the inputText then i cannot focus on the inputtext whatever i do. i tried to set imgui:setKeyboardFocusHere(2) and different values instead of 2, i also tried to set a flag on isWindowAppearing and then right before the inputtext i call setKeyboardFocusHere() if this flag is true, but none of these work as i want.
the gif i do not see well, the code looks something like what i want to make work but for me it does not focus. e.g. in your code ui:setKeyboardFocusHere() will focus on the next item, which is the Save button, am i right? at least according to the documentation. so how would it focus on the previous item?
@rrraptor, somehow miraculously it works now, all i changed was setting the width of the popup with imgui:setNextWindowSize(200, 90, ImGui.Cond_Once) i hope it stays working. now i only need to find out the reason for the multiple backspaces in the inputtexts.
Comments
https://deluxepixel.com
Fragmenter - animated loop machine and IKONOMIKON - the memory game
note that one can use isKeyPressed to close the popup when esc is pressed etc.
Fragmenter - animated loop machine and IKONOMIKON - the memory game
https://deluxepixel.com
https://deluxepixel.com
should do the job with the right offset value, see:
https://github.com/ocornut/imgui/blob/master/imgui.h#L797
Likes: SinisterSoft
Fragmenter - animated loop machine and IKONOMIKON - the memory game
this works also for text etc instead of a button i think, just change the the first line accordingly.
Likes: SinisterSoft
Fragmenter - animated loop machine and IKONOMIKON - the memory game
Likes: SinisterSoft
Fragmenter - animated loop machine and IKONOMIKON - the memory game
https://www.gitmemory.com/issue/ocornut/imgui/331/751372071
Likes: SinisterSoft
Fragmenter - animated loop machine and IKONOMIKON - the memory game
see in the attached image the demo window is clipped for some reason. perhaps when resizing the window one has to reinitialize imgui rendering too?
Fragmenter - animated loop machine and IKONOMIKON - the memory game
Likes: keszegh
for the menu+titlebar combo yes please add this to the final build. then i guess what i see on your gif is a menubar, and you used some additional trick to make it grabbable like a titlebar, so please share that code bit too at some point.
Fragmenter - animated loop machine and IKONOMIKON - the memory game
And here some words have their first letters cut off, and the numbers in the calendar are missing.
@hgy29 any thoughts?
Neither my PC nor the PC on which the screenshots were taken has external GPU.
This is how is should look:
And here is my version:
https://github.com/MultiPain/Gideros_ImGui/blob/599edc5a86f03e474ba4e64938895fc085154849/imgui_src/imgui.cpp#L3609
All you have to do is to set "MoveFromTitleBarOnly" to true.
But for title text Im not sure... I made a separated widget that is basically "ImGui:menuItem()", but it does not work well...
So I removed my own table of content.
Likes: vitalitymobile
Added callbacks for InputText, syntax:
Likes: MoKaLux, SinisterSoft
https://github.com/MultiPain/Gideros_ImGui#input-text-callbacks
Likes: SinisterSoft
which looks also good but due to hard to spot issues it is likely that it won't end up in a release version. nevertheless i'd be really happy to have this feature.
btw as an alternative, if i could set the width of the 'top' menu bar (MainMenuBar), i.e. so that it does not go all the way to the right, that would also give me a partial workaround for this issue. would that be simpler to do? i can see one solution to have two imgui items, one only for this mainmenubar clipped to the size i want, and another imgui item for all the rest of the windows. but perhaps there is a nicer solution.
being able to move around that mainmenubar as if it would be its own titlebar would also be good of course.
Fragmenter - animated loop machine and IKONOMIKON - the memory game
Autocompletion + select file with keyboard. Looks cool I dont think that I can do it.
Likes: MoKaLux
does not seem to exist contrary to the docs.
(it seems to me that ImGui:openPopupContextItem is obsolete and this is supposed to be its replacement)
Fragmenter - animated loop machine and IKONOMIKON - the memory game
So I decided to use old name in LUA for backward compatibility.
Fixed. Old function now throws an error
Likes: keszegh
Fragmenter - animated loop machine and IKONOMIKON - the memory game
Likes: keszegh, MoKaLux
this works fine:
Fragmenter - animated loop machine and IKONOMIKON - the memory game
e.g. in your code ui:setKeyboardFocusHere() will focus on the next item, which is the Save button, am i right? at least according to the documentation. so how would it focus on the previous item?
Fragmenter - animated loop machine and IKONOMIKON - the memory game
Fragmenter - animated loop machine and IKONOMIKON - the memory game
imgui:setNextWindowSize(200, 90, ImGui.Cond_Once)
i hope it stays working.
now i only need to find out the reason for the multiple backspaces in the inputtexts.
Fragmenter - animated loop machine and IKONOMIKON - the memory game
Likes: keszegh