Widget button problem
Hello! Basically I have a widget of codeLock with the keypad (buttons). I have some buttons and text window to fulfill it with the password. I want to make button 1 print the number "1" right in to text window. Button two - print 2, button three - print 3 and etc... How can I make it? Right now player click manualy on Text box for password and write there with the keyboard. But I want to make that text box not clickable for player. Only buttons bellow are clickable. Thank you!
asked Sep 22 '18 at 12:12 PM in Blueprint Scripting
its actually pretty simple for this situation. in your widget create a variable that will store the text, in this case i named my variable DisplayText and its type is string. its important that the variable be a string so that we can use the append node later. ok now that you have the variable you need to create a on click event for each button (i only did 2 buttons in the example below). now you can setup the script shown below by getting your variable, adding an append node, then setting your variable. this will basically just take the variable add the value of the B pin to the end then set the variable value. so if the variables value was 132 then you pressed the 4 button the variable would become 1324. obviously the B pin will correspond to the button pressed. the last thing we need to do is make it so the text component displays the variables value. to do this we just need to bind it, next to where it says text in the details panel there will be a drop down that says bind, here select your variable (you may need to compile for it to show). and that should be it
answered Sep 22 '18 at 02:47 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here