Author Topic: Key pad location  (Read 3252 times)

sirius0

  • Newbie
  • *
  • Posts: 4
    • View Profile
Key pad location
« on: August 19, 2016, 02:32:46 AM »
Hi All,
First post :-) Been living the dream with AdvancedHMI thank you Archie!

is it possible to locate the keypad elsewhere on the screen? As being in the middle has my user forgetting what they are editing!
is it possible to have it as a movable object?

Location is an instance of iKeypad but i can't seem to get how to assign a point to it.
Thank you
Chris

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5324
    • View Profile
    • AdvancedHMI
Re: Key pad location
« Reply #1 on: August 19, 2016, 06:34:28 AM »
- In Solution Explorer, expand down the AdvancedHMIControls project, then expand down the \Controls folder
- Right click the BasicLabel.vb and select View Code
- Far down in the code, look for #Region "Keypad popup for data entry"
- Expand down that Region, then look for             KeypadPopUp.StartPosition = Windows.Forms.FormStartPosition.CenterScreen
- Change from CenterScreen to Manual
- Right after that, add the line of code:
Code: [Select]
            KeypadPopUp.Location = New Point(0, 0)

Now when you use the BasicLabel, the keypad should popup in the upper left.

bachphi

  • Hero Member
  • *****
  • Posts: 674
    • View Profile
Re: Key pad location
« Reply #2 on: August 19, 2016, 10:12:14 AM »
For those who dont use keypad from BasicLabel, the code below give you a flexibilty in adjusting width, font , color, location, etc,

Code: [Select]
Dim kpd As New MfgControl.AdvancedHMI.Controls.Keypad(320)  'width=320
        kpd.Font = New Font("Arial", 14, FontStyle.Bold)
        kpd.ForeColor = Color.AliceBlue
        kpd.Text = "Enter Tip Number:"
        kpd.StartPosition = Windows.Forms.FormStartPosition.CenterScreen 'or manual
        'kpd.Location = New Point(0,0)
        kpd.TopMost = True
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================

sirius0

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Key pad location
« Reply #3 on: August 22, 2016, 03:14:06 AM »
Hi Archie,
Thank you! Worked like a charm. I see from the 'IF' set up i could likely have a different position for the alphanumeric as opposed to the numeric. Yes; might as well contribute!
The below allows for a different position for the numeric keypad and an alphanumeric keypad.

Code: [Select]
If m_KeypadAlphaNumeric Then
                    KeypadPopUp = New MfgControl.AdvancedHMI.Controls.AlphaKeyboard(m_KeypadWidth)
                    KeypadPopUp.StartPosition = Windows.Forms.FormStartPosition.Manual
                    KeypadPopUp.Location = New Point(200, 571)

                Else
                    KeypadPopUp = New MfgControl.AdvancedHMI.Controls.Keypad(m_KeypadWidth)
                    KeypadPopUp.StartPosition = Windows.Forms.FormStartPosition.Manual
                    KeypadPopUp.Location = New Point(832, 571)
End if



This leads to four more questions:
1. How do i make a Code Select box? Ahh got it! :)
2. Is there a way to make the keypad a dragable/movable box?
3. I get the impression from bachphi (thank you) that we don't have to use the keypad; how is this done?
4. How do i get the label currently being entered via the keypad or otherwise to highlight so the user does not lose where they are at?


« Last Edit: August 22, 2016, 03:19:55 AM by sirius0 »

DanieLoche

  • Guest
Re: Key pad location
« Reply #4 on: August 22, 2016, 06:09:37 AM »
About your last questions:

2. You might try to look at the window style properties:
Code: [Select]
KeypadPopUp = New MfgControl.AdvancedHMI.Controls.AlphaKeyboard(m_KeypadWidth)
                    KeypadPopUp.FormBorderStyle = FormBorderStyle.FixedDialog 'For example
If you want all you keypads to have such property, I recommend you to go were the control is stored ("Purchased control" folder I suppose) and edit there the property in the property panel.
This way you can also edit the Keypad to fit your needs.
Note: I might be speaking to fast... this is only available for the AlphaKeyboard, not sure for the Keypad (it's a .dll, no ?)
But all in all, with the AlphaKeyboard, just deleting the letters and resizing, you can create a new easy to custom Keypad !

3. ... perfect transition for the next question, as you can ignore the Keypad properties of your control, and instead use the Click Event. There, add the code to show a virtual keypad/keyboard (following your need), and use the output text:
Example :
Code: [Select]
    Private Sub EditBtn_Click(sender As Object, e As EventArgs) Handles EditBtn.Click
        Dim kpd As New AdvancedHMIControls.AlphaKeyBoard2
        kpd.PassWordCharacters = False        ' Edit some properties of your Keyboard here, if needed.
        Dim dr As DialogResult = kpd.ShowDialog()

        If dr = DialogResult.OK Then
            Dim newText = kpd.TextBox1.Text
            '
            ' Make something with your output. You can check some conditions before using it (text lenght, convert to integer...)
            '
           sender.text= newText  ' classic use for a textbox.
        End If
    End Sub
Works the same with the Keypad I suppose.

4. You can use the Click Event again. It's quite paintful as you have to add it to every control using a keypad...
Code: [Select]
    Private Sub EditBtn_Click(sender As Object, e As EventArgs) Handles EditBtn.Click
       sender.Backcolor = Color.Red ' Choose your highlighting color here.
    End Sub

It's harder for the un-highlighting part...
In code, if you used the solution above you can just add at the end (after the End If): sender.Backcolor = Color... ' Default color here
Otherwise, in the ValueChanged Event (as when the keypad is hidden again, the value must have changed accordingly).

MrPike

  • Sr. Member
  • ****
  • Posts: 297
    • View Profile
Re: Key pad location
« Reply #5 on: September 03, 2016, 10:39:15 AM »
Hello Archie.  I have noticed the keypad does not always open in the center screen.  The first 3-4 times it is opened it does open center screen but after that it seems to open in the upper left of the screen.  Also I believe the keypad is "modal"(just learned that in class!).  I have several textboxes on my form that I want to edit without having to close the keypad every time.  How can I do this?  Thx

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5324
    • View Profile
    • AdvancedHMI
Re: Key pad location
« Reply #6 on: September 03, 2016, 11:03:21 AM »
Hello Archie.  I have noticed the keypad does not always open in the center screen.  The first 3-4 times it is opened it does open center screen but after that it seems to open in the upper left of the screen.  Also I believe the keypad is "modal"(just learned that in class!).  I have several textboxes on my form that I want to edit without having to close the keypad every time.  How can I do this?  Thx
Are your TextBoxes, the standard boxes from the All Windows Forms group in the Toolbox? The keypad doesn't mimic a keyboard, so you would need a way to tell it where to store the entered information. If you wanted to get elaborate, you could make it mimic a keyboard by modifying it to perform keyboard stuffing.

MrPike

  • Sr. Member
  • ****
  • Posts: 297
    • View Profile
Re: Key pad location
« Reply #7 on: September 03, 2016, 10:15:28 PM »
They are standard text boxes from the All Window group and the keypad works fine with them to enter the data. I just want to be able to have it stay open so when I click on another text box it doesn't have to reopen. Because after several times of opening it, it will begin to open in the upper left of the screen instead of the center causing it to cover some of the other text boxes. Basically it opens once at center screen and enters data to whatever text box I click.