Input Panel

Discussion in 'Code Samples & Tips' started by Erel, May 7, 2007.

  1. Erel

    Erel Administrator Staff Member Licensed User

    This is an example of using a panel to create a pseudo input box.
    You can easily customize it to fit your needs.
     

    Attached Files:

  2. ThaleoSis

    ThaleoSis New Member Licensed User

    Es muy simple. Es muy ingenioso. Es un buen ejemplo :sign0098:
    Gracias.
     
  3. Filippo

    Filippo Expert Licensed User

    A new Inputpanel

    A new Inputpanel

    Ciao,
    Filippo
     

    Attached Files:

  4. Rioven

    Rioven Active Member Licensed User

    cool!
    it's runaway inputpanel!:D
     
  5. Cableguy

    Cableguy Expert Licensed 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!!!!
     
  6. Rioven

    Rioven Active Member Licensed 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)...:)
     
  7. Filippo

    Filippo Expert Licensed User

    Inputpanel for PocketPC and Desktop

    Ciao,
    Filippo
     

    Attached Files:

  8. specci48

    specci48 Well-Known Member Licensed 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:
    Code:
    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.
     
  9. alfcen

    alfcen Well-Known Member Licensed 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
     
  10. Cableguy

    Cableguy Expert Licensed 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?
     
  11. RandomCoder

    RandomCoder Well-Known Member Licensed User

    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
     
  12. alfcen

    alfcen Well-Known Member Licensed User

    Yes, Cableguy, another DLL or implemented as a general keyword, such like the message box. I am sure Erel can handle that. :)
     
  13. Cableguy

    Cableguy Expert Licensed 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: Jul 2, 2007
  14. dzt

    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.
     
  15. RandomCoder

    RandomCoder Well-Known Member Licensed User

    This is exactly as I was meaning. I think it will work.

    Regards,
    RandomCoder.
     
  16. alfcen

    alfcen Well-Known Member Licensed 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 :)
     
  17. RandomCoder

    RandomCoder Well-Known Member Licensed 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.
     
  18. alfcen

    alfcen Well-Known Member Licensed 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.
     
Loading...