Input Panel

Erel

B4X founder
Staff member
Licensed User
Longtime User
This is an example of using a panel to create a pseudo input box.
You can easily customize it to fit your needs.
 

Attachments

  • InputPanel.sbp
    1.3 KB · Views: 900
  • Picture2.jpg
    Picture2.jpg
    15.5 KB · Views: 820
D

Deleted member 103

Guest
A new Inputpanel

A new Inputpanel

Ciao,
Filippo
 

Attachments

  • InputPanel.zip
    2.2 KB · Views: 737

Rioven

Active Member
Licensed User
Longtime User

Cableguy

Expert
Licensed User
Longtime User
Cool?

I don't see the point of a runaway panel, unless it was meant as a joke...In that case, it works, it got me LOL!!!!
 

Rioven

Active Member
Licensed User
Longtime User
I've tried on the device and it works but not quite on desktop, but the application is for device though.
:sign0013:...I just thought the idea when application's trial version period was over...You can label the panel "Trial version, continue?"...if they can't catch the "yes" button, they urge to buy it (but should be a good one)...:)
 
D

Deleted member 103

Guest
Inputpanel for PocketPC and Desktop

Ciao,
Filippo
 

Attachments

  • InputPanel.zip
    2.2 KB · Views: 644

specci48

Well-Known Member
Licensed User
Longtime User
Hi Filippo,

since you can move your panel completly out of the form (on the device and desktop) with no change of getting it back, you should implement some borders like:
B4X:
Sub MovePanel(Panel,x,y)
   Control(Panel).left=Min(Max(-Control(Panel).Width + 10,Control(Panel).left+(x-pX)),230)
   Control(Panel).top=Min(Max(-10,Control(Panel).top+(y-pY)),260)
End Sub
Now always a part of the top is accessible.
 

alfcen

Well-Known Member
Licensed User
Longtime User
Gentlemen,
Similarly to a message box, an input box makes sense only when program execution is stopped until an input was provided.
What do you think?
Cheers
Robert
 

Cableguy

Expert
Licensed User
Longtime User
I agree, An input box IS used when some aditional information is needed by the app, so app should stop when inputbox is shown...But this would require a DLL wouldn't it?
 

RandomCoder

Well-Known Member
Licensed User
Longtime User
CableGuy originally wrote:
But this would require a DLL wouldn't it?

If you compare it with a MsgBox then I don't think it would as program execution appears to halt until OK or one of the other MsgBox buttons is pressed.
The only way around this is by using Do Events before calling the MsgBox which would allow other event driven subs to sub simultaneously run, I think :confused:

Regards,
RandomCoder
 

alfcen

Well-Known Member
Licensed User
Longtime User
Yes, Cableguy, another DLL or implemented as a general keyword, such like the message box. I am sure Erel can handle that. :)
 

Cableguy

Expert
Licensed User
Longtime User
Since I have a copy of VS5Pro installed I went to take a peek and there is a inputpanel control, so a dll is possible...and I'm guessing that one of the inputpanel methods do a halt to events until input..
Still I don't see How B4ppc is multi-thread, the code allway seems to be like in a flowchart execution way....So eve a simple input panel ( even a coded one ) halts execution until the user decides what to do with the inputed info...
 
Last edited:

dzt

Active Member
Licensed User
Isn't so difficult to make an input panel to have similar behaviour like a real inputbox. Disable controls of the form and put caller code in a loop (with doevents) waiting for a variable to be true when the user will press a button of the input panel.

I think this will do the trick.
 

RandomCoder

Well-Known Member
Licensed User
Longtime User
This is exactly as I was meaning. I think it will work.

Regards,
RandomCoder.
 

alfcen

Well-Known Member
Licensed User
Longtime User
Gentlemen,
DoEvents in a Loop Until does work indeed. It would just be more elegant to have the system open a nice input box without additional controls and workaround source code. This is issue probably better placed in the Wishlist category :)
 

RandomCoder

Well-Known Member
Licensed User
Longtime User
Do you mean something like IgnoreEvents True or False??
That would appear to be a simple solution but then there might be undesirable side effects like being unable to catch the KeyPress Event to catch user mistakes etc.

Regards,
RandomCoder.
 

alfcen

Well-Known Member
Licensed User
Longtime User
Hi RandomCoder
It's a bit cluttered but this works for me for a while:


Sub App_Start
reg.New1
honyaku="your_registration_code"
Registration
:::::::::
End Sub

Sub Registration
frmRegistration.Show 'A form with a text box and an OK button
Do
DoEvents
Loop Until mnuRegister.Enabled=False
If txtRegister.Text=honyaku Then
Return 'continue with code in App_Start
Else
AppClose 'or prohibit any further use after tap on (ok) if the registration key is wrong
End If
Else
MsgBox("Unregistered Version!"," Shareware Info", cMsgBoxNone, cMsgBoxAsterisk)
End if
End If
End Sub

Sub buttRegister_Click 'the OK button
if txtRegister.Text=honyaku Then
reg.RootKey(reg.rtCurrentUser)
key = "Software\RBSoft\Mokusei"
reg.SetStringValue(Key,"Owner",honyaku)
MsgBox("The software is now registered. Thank you!"," Shareware Info", cMsgBoxNone, cMsgBoxAsterisk)
mnuRegister.Enabled=False
Else
MsgBox("Wrong registration key!"," Shareware Info", cMsgBoxNone, cMsgBoxHand) 'mnuRegister still enabled
End if
End Sub

Sub mnuRegister_Click
frmRegistration.Show
End if


Please be aware that the registration key in honyaku="your_registration_code" in the compiled exe is visible in a HEX viewer, hence not safe enough a solution.
 
Top