C
C#4mo ago
Stark✨

Metro Set Ui Key Events dont work

am trying to create a simple program using windows forms C# and have a text box and a list... i can add text to the list using another button but when i try to add text using the keypress event it just dings and nothing happens
33 Replies
SinFluxx
SinFluxx4mo ago
$details
MODiX
MODiX4mo ago
When you ask a question, make sure you include as much detail as possible. Such as code, the issue you are facing, and what you expect the result to be. Upload code here https://paste.mod.gg/ (see $code for more information on how to paste your code)
Stark✨
Stark✨4mo ago
BlazeBin - ciohcrupjgkk
A tool for sharing your source code with the world!
Stark✨
Stark✨4mo ago
my input is a keypress <Enter> in the text box and i expect it to fill the list with what ever content the text box has but this isnt happening and i just hear a ding sound once i press the key
SinFluxx
SinFluxx4mo ago
Have you tried debugging to see what's actually happening?
Stark✨
Stark✨4mo ago
there is no error whatsoever
SinFluxx
SinFluxx4mo ago
Right, but debug to see if it's actually hitting that event handler at all Set a breakpoint, run your app, press enter in the textbox
Stark✨
Stark✨4mo ago
nope it dosent hit the event handler
SinFluxx
SinFluxx4mo ago
Have you checked the properties of your textbox to see if the event handler for KeyDown is set correctly?
Stark✨
Stark✨4mo ago
yes key preview is true
SinFluxx
SinFluxx4mo ago
So you're handling it in a different event handler?
Stark✨
Stark✨4mo ago
no its in the same event handler or i dint get what u were tryna say
SinFluxx
SinFluxx4mo ago
well you'd set keypreview = true if you want the key press event to be handled by your Form rather than by the specific control https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.form.keypreview?view=windowsdesktop-8.0 So I assumed you mentioned that because you were handling the keydown event in some other event handler...
Stark✨
Stark✨4mo ago
yea i want it to be handled by the form but if u mean handling by the form is not same as being handled by the text box in the form i think its better off no no i want the key event handler just for the text box
SinFluxx
SinFluxx4mo ago
Right, so you don't need to set KeyPreview = true then?
Stark✨
Stark✨4mo ago
is that a question? T_T
SinFluxx
SinFluxx4mo ago
Sort of, unless you've got it set because of some other reason I don't think you need it set
Stark✨
Stark✨4mo ago
no no i just set it true for this purpose i dont need it for anything else
SinFluxx
SinFluxx4mo ago
Then you don't need it set
Stark✨
Stark✨4mo ago
ok i set it true cuz some forums said it helps
SinFluxx
SinFluxx4mo ago
If there's a reason to set it, like you want to handle key press events at a form level first, then go on to the specific control event handler then sure Are you still seeing the issue after removing that?
Stark✨
Stark✨4mo ago
it was already removed previously and i still had the issue.. turning it on dint have any effecct also am using a metro set ui can this be the reason?
SinFluxx
SinFluxx4mo ago
Shouldn't be In your textbox properties, is the KeyDown event handler properly set?
SinFluxx
SinFluxx4mo ago
No description
Stark✨
Stark✨4mo ago
yea it is set
SinFluxx
SinFluxx4mo ago
Saying that, someone did log this: https://github.com/N-a-r-w-i-n/MetroSet-UI/issues/44
GitHub
MetroTextBox not react to keys · Issue #44 · N-a-r-w-i-n/MetroSet-UI
Don't work with _keydown, for "Enter" keycode at leat.
SinFluxx
SinFluxx4mo ago
Maybe just try it with a normal winforms textbox and see if that works
Stark✨
Stark✨4mo ago
i could but i already built my program using metroset ui T_T
SinFluxx
SinFluxx4mo ago
For the sake of proving the point it will only take you a minute to try it
Stark✨
Stark✨4mo ago
ai8 lemme make one quick yea it workes in a normal form @SinFluxx
SinFluxx
SinFluxx4mo ago
I mean the easiest way might be to move it to the KeyUp event instead?
Stark✨
Stark✨4mo ago
i tried all three
SinFluxx
SinFluxx4mo ago
I mean that issue I linked above was logged 2021, and from a glance there haven't been any updates to the repo in 4 years, so it may just be an issue you're stuck with unless someone knows some way around it
Want results from more Discord servers?
Add your server
More Posts
Word getting cut off because string is longer than the consoleHello, I am doing the finishing touches on the little star wars database I created as practice for C[ASP.NET CORE MVC] trying to add js dependency to my project, but its not being recognized.Im trying to add a pagination library to my app, but the script is not working when i add the scriptFfmpegWrapper@cybercola i'll make a thread to prevent clogging. im sorta stuck with implementing it and using it How do I easily modify *any* property/object/nested object of C# deserialized .json?config/data.json { "title": "XYZ", "obj1": { "s1": -1, "s2": "auto", Windows Worker Service times outHello. Everytime I want to start my Worker Service I get the message that it doesnt reacted in time ✅ Circular ReferencesBeing unable to do circular references seems like an unnecessary roadblock in some cases, at least fHow can I decode Avro Message that have an embedded schema and after the message content?How can I decode Avro Message that have an embedded schema and after the message content. I receiveMsgbox helphow can i create a msgbox with custom "dialog button", i mean, not a form, a msgbox with custom dialhow can I make it so that it doesn't need to open up a whole new MainWindow when I try to go back?https://cdn.discordapp.com/attachments/169726357331378176/1209213220758364281/unknown_2024.02.19-19.Trying to understand this abstract code (and use it elsewhere)``` using System; using System.Collections; using System.Collections.Generic; using UnityEngine; pu