Adding virtual numeric keypad

Discussion in 'Questions (Windows Mobile)' started by jschuchert, Sep 21, 2009.

  1. jschuchert

    jschuchert Active Member Licensed User

    I want to add a numeric keypad to about 15 forms but only want to design one and have it placed on the others at runtime (copying and pasting doesn't work). It would be in a panel with each number a very small button and I would code what happens when a numbered button is pressed. I experimented with addobject and addpanel but apparently don't know what I'm doing. I did it (with expert help) in NSBasic by using code like this in the load event for each form:

    SetParent frame2,area_form
    frame2.move 156,130 'adjusted the location of the keypad
    formname="area"

    The actual designed keypad (in frame2) appeared on only on 1 form and the others were added at runtime as a form was called. I'm confident it can be done in b4ppc but need some direction. Thanks.

    Jim Schuchert
     
  2. Ariel_Z

    Ariel_Z Active Member Licensed User

    See the source code I've offered as a solution here: http://www.basic4ppc.com/forum/questions-help-needed/4856-big-ok-button-msgbox.html

    The code demonstrates how to add a panel at runtime, how to add a button to it and how to cause it to pop up. It also shows how to consume the relevant events.

    You can try it out this and I will be glad to help you out. I guess we can try developing a module that does just this and publish it - many programmers encounter this need.

    You will probably have questions - please post them here.
     
  3. taximania

    taximania Well-Known Member Licensed User

    Here you go, a simple number pad based on Ariel's code :sign0188:
    I'm sure Erel had already done this before ??

    The only error check is so that the decimal point can't be pressed twice.

    The number entered by pressing the 'X' button is stored in the
    global variable 'numer'

    And yes, it doesn't need all the _click routines. I was just idle :sign0025:
     

    Attached Files:

  4. jschuchert

    jschuchert Active Member Licensed User

    Thank you. I got that far but am hung up when I need to enter numbers from the keypad into various text boxes. I can't seem to get the 'focus' syntax correct when going from tb to tb. For example:

    Sub btn1_click
    If tb1.focus = True Then 'this is first text box don't know syntax
    tb1.text=tb1.text & "1"
    Else
    If tb2.focus = True Then 'this is second text box
    tb2.text=tb2.text & "1"
    End If
    End If
    End Sub

    where is the button 'numerica' added?
    how does the 'timer' come in play?
     
  5. Erel

    Erel Administrator Staff Member Licensed User

  6. jschuchert

    jschuchert Active Member Licensed User

    Adding virtual keypad

    Thank you Erel, Ariel and Taximania for the great suggestions. Hopefully I can take it from here with the reservation that I can come back for more excellent advice. You guys are awesome.

    Incidentally, for whatever reason, I can not get the 'properties' links (in blue)on the right side of the help screen for the 'controls' to work. They hang up IE and I have to restart. Seems like they worked before.

    Jim
     
  7. Erel

    Erel Administrator Staff Member Licensed User

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice