Closed PoshoDev closed 4 years ago
Interesting. The input rectangles are each their own surface (this makes it easier to do things like keep text from spilling out-of-bounds and looking bad), but they should handle themselves without any outside interference. Does this happen when you do something specific, or for any and all input boxes?
Any input box. I've been using EmuTextbox_H
just as you use them in the demo. They draw fine but as soon as I click it it crashes.
Poked around a bit, nothing stood out. Could you send an example project?
Here's the commit when I last worked with Emu. Press 'N' to bring up the Emu container. I'm pretty sure this has to be an issue on my behalf, just don't know what it is. Also, please ignore the spaghetti. 👉👈🍝 Project.zip
Oh, I see what's going on. The callback methods run in the scope of the instance they've been attached to, which in this case would be the text box. I'm not sure why yours was complaining about the surface stack (I just got Variable EmuTextbox_H.task_new(100408, -2147483648) not set before reading it
), but the variable task_new
doesn't exist in the scope of the function because that's already the struct that's running the code - imagine using the with()
statement on an instance in old GameMaker.
GameMaker allows you to define instance variables anywhere so you can always just attach your own variables to the text box:
// New Task Tab
var textbox = new EmuTextbox_H(32, EMU_AUTO, 512, 32, "Title:", task_new.title, "Empty", 32, E_InputTypes.STRING, function() { task.title = value; });
textbox.task = task_new;
tab_newtask.AddContent([
new EmuText(32, EMU_AUTO, 512, 32, "New Task"),
textbox,
]);
There are some other things you can do like making task_new
globally accessible but that's probably the most straightforward.
Ooh, it makes sense. Thank you so much for your troubles!
Hey Michael,
I finally got time to use this life-saving extension and I encountered an error I don't understand. 🤔
When I click in one of my text boxes I get this error:
I looked everywhere in the included
obj_emu_demo
forsurface_reset_target()
and it is never referenced so I don't know what's happening.This is how I'm adding the textbox, if it helps:
Hope you can help me with this. I'm enjoying this extension so far! 😄
Cheers, Posho