Get a input string from user

vinians

Member
Licensed User
Longtime User
There are a function to get a string from user like InputBox or I need to create a form do do this task?
 

Cableguy

Expert
Licensed User
Longtime User
Usually we use a panel with a label describing/asking an input and a textbox for the user to input and a button to trigger the input action....but its also simple to create a custom control (dll) with this function...
 

dzt

Active Member
Licensed User
Usually we use a panel with a label describing/asking an input and a textbox for the user to input and a button to trigger the input action

For what Cableguy describing above look at this thread http://www.b4x.com/forum/showthread.php?t=108

....but its also simple to create a custom control (dll) with this function...

Hello Cableguy,

It won't be difficult to create a clone of your AboutPanel library (named for example InputBox and using .ShowDialog) to act like a modal InputBox. Think about it, no hurry at all, we all can wait until... this evening ;)

Cheers
 

Cableguy

Expert
Licensed User
Longtime User
"Your system will melt down in 10....9...8....7..."


Well, almost.....Got a virus and had to re-install my system.....

That part is done, now I have to re-install and configure all the other apps, including b4ppc and sharpdevelop....:sign0148:

Hopefully I'll have all working by tomorow and start on the imput panel....

In the meantime, please provide some props/features that you would like to see in an input panel, and if possible, a graphical example of how it would look....
 

Cableguy

Expert
Licensed User
Longtime User
InputPanel is now in its coding stage, but a doubt has rised....

I learned how to manage button click events inside the class, but how can I pass it to b4ppc?

I have contructed the click event....what do i put inside it? a simple get/set?
 

Cableguy

Expert
Licensed User
Longtime User
B4X:
'btn1 is the OK button, so it should pass the textbox(txt) value....
private void btn1_Click(System.Object sender, System.EventArgs e)
      {
         get{ return txt.text;}
      }
'btn2 is the Clear button, so it should Clear the textbox(txt) value....
private void btn1_Click(System.Object sender, System.EventArgs e)
      {
         txt.text=""
      }

Would this be correct???

When validating user input, whats the best form of action, to hide the panel or to dispose of it?
 

dzt

Active Member
Licensed User
Hello,

To show a modal dialog use .showdialog

B4X:
[SIZE=2][COLOR=#008000][B][SIZE=2][COLOR=#0000ff]public [/COLOR][/SIZE][/B][SIZE=2][COLOR=#ff0000]string [/COLOR][/SIZE][B][SIZE=2][COLOR=#191970]Show[/COLOR][/SIZE][/B][SIZE=2][COLOR=#006400]()[/COLOR][/SIZE]
[SIZE=2][COLOR=#006400]{[/COLOR][/SIZE]
[SIZE=2][COLOR=#000000]  frmInputBox[/COLOR][/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][B][SIZE=2][COLOR=#191970]ShowDialog[/COLOR][/SIZE][/B][SIZE=2][COLOR=#006400]();[/COLOR][/SIZE]
 
[SIZE=2][COLOR=#000080]  return [/COLOR][/SIZE][SIZE=2][COLOR=#000000]StringTypedByUser[/COLOR][/SIZE][SIZE=2][COLOR=#006400];[/COLOR][/SIZE]
[SIZE=2][COLOR=#006400]}[/COLOR][/SIZE]
[/COLOR][/SIZE]

And to close your InputBox...

B4X:
[B][SIZE=2][COLOR=#0000ff]private [/COLOR][/SIZE][/B][SIZE=2][COLOR=#ff0000]void [/COLOR][/SIZE][B][SIZE=2][COLOR=#191970]btnOK_Click[/COLOR][/SIZE][/B][SIZE=2][COLOR=#006400]([/COLOR][/SIZE][SIZE=2]System[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Object sender[/SIZE][SIZE=2][COLOR=#006400], [/COLOR][/SIZE][SIZE=2]System[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]EventArgs e[/SIZE][SIZE=2][COLOR=#006400]) [/COLOR][/SIZE]
[SIZE=2][COLOR=#006400]{[/COLOR][/SIZE]
[SIZE=2]  frmInputBox[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][B][SIZE=2][COLOR=#191970]Close[/COLOR][/SIZE][/B][SIZE=2][COLOR=#006400]();[/COLOR][/SIZE]
[SIZE=2][COLOR=#006400]}[/COLOR][/SIZE]
 
Last edited:

Cableguy

Expert
Licensed User
Longtime User
Well I ahd a litle time today at work, so I created an almost fully customizable input panel in basic4ppc...

If its good enought, I'll passe it to a dll...hopefully by the weekend....
 

Attachments

  • Test.sbp
    1.9 KB · Views: 313
Top