1) It seems that the whole content is not "centered": the distances marked with the circled numbers 1 and 2 is not equal. I guess it is due to some kind of preset margin/padding? How do I fix this?
2) How do I center/reposition elements on screen inside imgui? I drew some red circles between the elements placed using ui:sameLine(): can we change that distance between elements, but only on certain elements?
3) If I want to screen center my first line of text (word1, word3, word4 in code) how can I do it?
4) What is the grey band (I marked it with 3) between the title and the content of the window? Where does it come from?
5) How do I style buttons? Change colors, alignment etc? I've found the section Style setters/getters on github but I am not smart enough to figure out how to use it.
6) I noticed that in some examples you make use of ui:newLine() to add elements on a new line; but this example works without it. Is it better to use it anyway?
Thank you a lot! I hope my questions are not too much annoying
Thank you @rrraptor I managed to understand how to center stuff too, I don't know if it's the best way to do it but I'd say it works. I've put together a super commented hello world project with styling example if someone else is interested. If you have time to validate it (ie I didn't do extreme mistakes ) feel free to post it on the wiki, in your github or wherever it might be found without looking inside this blobby thread
there is still a question without an answer: 6) I noticed that in some examples you make use of ui:newLine() to add elements on a new line; but this example works without it. Is it better to use it anyway?
Hi, is it possible to drag to scroll a clipper clipped list, as we do everyday on our phones with internet browsers, social network and stuff?
I've found this thread but I am not able to make this work due to my lack of knowledge: should this be compiled directly into imgui source? I tried translating it to lua but I guess I did something wrong because I don't know anything about C/C++
This is my lua translation, and it breaks because it can find getCurrentContext() - it finds something if I call it using a single dot but then it breaks on the next line. And it can't find getIO().mouseDelta
localfunction ScrollWhenDraggingOnVoid(delta, mouse_button)local g = ui:getCurrentContext()local window = g.CurrentWindow
local hovered =falselocal held =falselocal button_flags = ImGui.ButtonFlags_MouseButtonLeft | ImGui.ButtonFlags_MouseButtonRight | ImGui.ButtonFlags_MouseButtonMiddle
if g.HoveredId ==0then-- If nothing hovered so far in the frame (not same as IsAnyItemHovered()!)
ui:buttonBehavior(window:rect(), window:getID("##scrolldraggingoverlay"), hovered, held, button_flags)if(held and delta.x ~=0)then
ui:setScrollX(window, window.Scroll.x + delta.x)endif(held and delta.y ~=0)then
ui:setScrollY(window, window.Scroll.y + delta.y)endendend--and just before ui:end() which I don't have, so I put it before ui:endWindow()local mouse_delta = ui:getIO().mouseDelta
ScrollWhenDraggingOnVoid(0 - mouse_delta.y, ImGui.MouseButton_Middle)
@pie all windows and context stuff is internal and not availiable in lua version. You can use something from here, but there is no binding for "buttonBehavior".
Also, there is no properties, e.g.
ui:getIO().mouseDelta
is wrong, but
IO = ui:getIO()local dx, dy = IO:getMouseDelta()
is correct
I can add all default "behavior" stuff in lua verison if needed
I can add all default "behavior" stuff in lua verison if needed
If that could "unlock" every imgui potential and the previous workaround I posted I'd love to use it, but I don't know how much work is involved to do it.. if you have time to do it I guess it is always better to have more than less options
It does not solves the problem, but atleast removes the popup.
this seems to work, thanks a lot.
hi @rrraptor , there seems to be an imgui fix for the ctrl+tab issue: https://github.com/ocornut/imgui/issues/4828 let me know when i can and how should i change my code to rely on this instead of your workaround. ty
hi @rrraptor , there seems to be an imgui fix for the ctrl+tab issue: https://github.com/ocornut/imgui/issues/4828 let me know when i can and how should i change my code to rely on this instead of your workaround. ty
Well, last stable version is still 1.88, so I would wait for 1.89
hi @rrraptor , there seems to be an imgui fix for the ctrl+tab issue: https://github.com/ocornut/imgui/issues/4828 let me know when i can and how should i change my code to rely on this instead of your workaround. ty
Well, last stable version is still 1.88, so I would wait for 1.89
Hi, I noticed that imgui works properly only if scale project setting is set to Top Left-No scale. Is that expected?
For example with the scale mode of the project set to "stretch" imgui is no longer able to understand where the touches/hovers happen. Is there any workaround for this behaviour? See attached project for a ready made example.
as a workaround you can modify the code i shared recently with manual touch generation with the proper scales, something like this where you need to compute the relevant constants: local xGui=event.touch.x/imgui_scaling_x local yGui=event.touch.y/imgui_scaling_y IO:setMousePos(xGui,yGui)
so again, would it be possible somehow to make a wacom pen also generate hover events when hovering? (for tooltip popups and button hover style-changes this would be very important)
indeed. @rrraptor ,i'd like to draw something on sliders that is above the slider background but behind the sliding bar and the counter for the slider. is that possible in some way without redrawing manually every part of the slider?
so again, would it be possible somehow to make a wacom pen also generate hover events when hovering? (for tooltip popups and button hover style-changes this would be very important)
@hgy29 , i would appreciate if you could look into this a bit.
Just had a look and it looks like our code is correct at Gideros level. In the thread you mnetion they say it was corrected in 5.9, but we are already using 6.3. I will try to get a wacom tablet again and see what happen
hi, do you have any clue about this error? [570] ../Common/imgui_src/imgui_internal.h: n < (Storage.Size << 5)
It sometimes happens when I build my FontAtlas, but it happens totally random: if I restart the app inside gideros player once or twice without making any edit it doesn't happen.
[edit] it sounds like as if something in gideros player is waiting for a reset/cache cleaning: if I close it and open it again it doesn't happen.
hi, do you have any clue about this error? [570] ../Common/imgui_src/imgui_internal.h: n < (Storage.Size << 5)
It sometimes happens when I build my FontAtlas, but it happens totally random: if I restart the app inside gideros player once or twice without making any edit it doesn't happen.
[edit] it sounds like as if something in gideros player is waiting for a reset/cache cleaning: if I close it and open it again it doesn't happen.</p>
To partially answer my own question (I still have some unexpected player hanging after uploading files) : sometimes happened that my first enterframe function (the one that also draws imgui itself) was called BEFORE FontAtlas was effectively built (ready to be used).
Now I understand the need for FontAtlas:isBuilt() method
Adding this check in my enterframe function fixed the reported error.
if FontAtlas:isBuilt()==falsethen--wait for fontAtlas to be readyprint("FONTATLAS?", FontAtlas:isBuilt())else--do enterframe stuff with imgui
ui:newFrame(e.deltaTime)
DrawWindow(ui)
notifications:draw()
ui:updateCursor()
ui:render()
ui:endFrame()end
i guess it is safer to generate the FontAtlas in an init function and not in a one called during enterframe, at least i had never such a problem doing it this way.
@keszegh my FontAtlas is generated in an init function, on enterframe I just check if it's already built. I've had this issue only through gideros player on my laptop though, and I presume it happens because I need a bunch of specific characters in 3 flavours (regular, italic and bold) which (I presume) sometimes take a bit longer to be built compared to how fast the addition of enterframe listener happens. The bug is not completely gone though: it just happens less often with that addition
@keszegh my FontAtlas is generated in an init function, on enterframe I just check if it's already built. I've had this issue only through gideros player on my laptop though, and I presume it happens because I need a bunch of specific characters in 3 flavours (regular, italic and bold) which (I presume) sometimes take a bit longer to be built compared to how fast the addition of enterframe listener happens. The bug is not completely gone though: it just happens less often with that addition
i see. even with isBuilt checking you cannot avoid the crash?
Unfortunately not, but it seems to me that it might have to do with something remaining hanging from a previous run on gideros player: (from gideros studio ide, guessing % ) it happens 90% if I re-run the app without stopping it before, 70% if I just stop and run, with a chance of gideros player not responding/crash 20% if I stop, wait some time and then run the app again. 0% on first player run
It does seem related to the size of textures though, because the chances of it happening lowered when I got rid of a 4th font and some images.
maybe related I had an app which created quite some big textures (see https://wiki.gideros.rocks/index.php/Texture.new please notice the extend default to true). On win32 build when the texture reached the 2Gb memory usage it just crashed! Thanks to new win32 64bit now I can go up to 4Gb before it crashes. But to prevent the crashes I had to set extend to false and that helped a lot decreasing the memory usage (no crash so far).
Comments
given the code:
I have this gui
Looking at the picture:
1) It seems that the whole content is not "centered": the distances marked with the circled numbers 1 and 2 is not equal. I guess it is due to some kind of preset margin/padding? How do I fix this?
2) How do I center/reposition elements on screen inside imgui?
I drew some red circles between the elements placed using ui:sameLine(): can we change that distance between elements, but only on certain elements?
3) If I want to screen center my first line of text (word1, word3, word4 in code) how can I do it?
4) What is the grey band (I marked it with 3) between the title and the content of the window? Where does it come from?
5) How do I style buttons? Change colors, alignment etc? I've found the section Style setters/getters on github but I am not smart enough to figure out how to use it.
6) I noticed that in some examples you make use of ui:newLine() to add elements on a new line; but this example works without it. Is it better to use it anyway?
Thank you a lot! I hope my questions are not too much annoying
Fragmenter - animated loop machine and IKONOMIKON - the memory game
Likes: pie
Fragmenter - animated loop machine and IKONOMIKON - the memory game
Thanks to your snippet I learned of the existence of
pushStyleVar() and popStyleVar() and even
I wonder if there is a more friendly method to write this but this answers to questions #2 and #5
Fragmenter - animated loop machine and IKONOMIKON - the memory game
Likes: pie
If you have time to validate it (ie I didn't do extreme mistakes ) feel free to post it on the wiki, in your github or wherever it might be found without looking inside this blobby thread
there is still a question without an answer:
6) I noticed that in some examples you make use of ui:newLine() to add elements on a new line; but this example works without it. Is it better to use it anyway?
Thank you
I've found this thread but I am not able to make this work due to my lack of knowledge: should this be compiled directly into imgui source?
I tried translating it to lua but I guess I did something wrong because I don't know anything about C/C++
https://github.com/ocornut/imgui/issues/3379#issuecomment-669259429
This is my lua translation, and it breaks because it can find getCurrentContext() - it finds something if I call it using a single dot but then it breaks on the next line.
And it can't find getIO().mouseDelta
Also, there is no properties, e.g.
I can add all default "behavior" stuff in lua verison if needed
Likes: pie
thank you
https://github.com/ocornut/imgui/issues/4828
let me know when i can and how should i change my code to rely on this instead of your workaround. ty
Fragmenter - animated loop machine and IKONOMIKON - the memory game
Fragmenter - animated loop machine and IKONOMIKON - the memory game
For example with the scale mode of the project set to "stretch" imgui is no longer able to understand where the touches/hovers happen.
Is there any workaround for this behaviour?
See attached project for a ready made example.
Thank you
local xGui=event.touch.x/imgui_scaling_x
local yGui=event.touch.y/imgui_scaling_y
IO:setMousePos(xGui,yGui)
Likes: pie
Fragmenter - animated loop machine and IKONOMIKON - the memory game
https://bugreports.qt.io/browse/QTBUG-57485?focusedCommentId=339844&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel
so again, would it be possible somehow to make a wacom pen also generate hover events when hovering? (for tooltip popups and button hover style-changes this would be very important)
Fragmenter - animated loop machine and IKONOMIKON - the memory game
@rrraptor ,i'd like to draw something on sliders that is above the slider background but behind the sliding bar and the counter for the slider.
is that possible in some way without redrawing manually every part of the slider?
Fragmenter - animated loop machine and IKONOMIKON - the memory game
Likes: MoKaLux
Fragmenter - animated loop machine and IKONOMIKON - the memory game
Fragmenter - animated loop machine and IKONOMIKON - the memory game
Likes: keszegh, MoKaLux
[570] ../Common/imgui_src/imgui_internal.h: n < (Storage.Size << 5)
It sometimes happens when I build my FontAtlas, but it happens totally random: if I restart the app inside gideros player once or twice without making any edit it doesn't happen.
[edit] it sounds like as if something in gideros player is waiting for a reset/cache cleaning: if I close it and open it again it doesn't happen.
sometimes happened that my first enterframe function (the one that also draws imgui itself) was called BEFORE FontAtlas was effectively built (ready to be used).
Now I understand the need for FontAtlas:isBuilt() method
Adding this check in my enterframe function fixed the reported error.
Likes: MoKaLux
Fragmenter - animated loop machine and IKONOMIKON - the memory game
I've had this issue only through gideros player on my laptop though, and I presume it happens because I need a bunch of specific characters in 3 flavours (regular, italic and bold) which (I presume) sometimes take a bit longer to be built compared to how fast the addition of enterframe listener happens.
The bug is not completely gone though: it just happens less often with that addition
even with isBuilt checking you cannot avoid the crash?
Fragmenter - animated loop machine and IKONOMIKON - the memory game
it happens
90% if I re-run the app without stopping it before,
70% if I just stop and run, with a chance of gideros player not responding/crash
20% if I stop, wait some time and then run the app again.
0% on first player run
It does seem related to the size of textures though, because the chances of it happening lowered when I got rid of a 4th font and some images.
Thanks to new win32 64bit now I can go up to 4Gb before it crashes. But to prevent the crashes I had to set extend to false and that helped a lot decreasing the memory usage (no crash so far).