Questions on SpecialKeys

Discussion in 'Questions (Windows Mobile)' started by HARRY, Feb 26, 2008.

  1. HARRY

    HARRY Active Member Licensed User

    Hi,

    As I have no room on the screen for a menu bar or additional button I want the middle Hardware Key to be used to ask for help information.

    As far as I can test, the form needs to have the focus in order to activate the Sub Form1_KeyPress (SpecialKey). This works with me only when the Form is originally loaded. Setting somewhere Form1.Focus does not set the focus on the Form.

    The above acts like that in executing the exe; working in debugging mode on the device, the effects are different.

    A strange effect I found during testing, is that pressing the middle Hardware Key, without having a Sub Form1_KeyPress (SpecialKey), causes the label having the focus on the moment of pressing to loose its text or may be a space is inserted in front of the text. The labels are that small that they can only show one digit.

    The test file attached illustrates the unexpected effects. Interested forum members should run that program, both as exe on the device as in debugging mode on the device.

    My device is a P350 of Mitac.

    Who can give some help?

    Harry
     

    Attached Files:

  2. Erel

    Erel Administrator Staff Member Licensed User

    There is only one large label in this attachment.
     
  3. derez

    derez Expert Licensed User

    I believe it shouldn't work at all without adding the hardware library and the Hardkey object.
    Read the help for declaring a Hardkey object (new1) - it says :

    OnlyWhenFormIsActive - If set to true then the keys will be caught only when the specified form is active.

    It means that if set to false - the key will be active no matter which form is displayed.
     
  4. HARRY

    HARRY Active Member Licensed User

    Erel,

    :sign0013: I attached the wrong file. Now the corect one is attached.

    Harry
     

    Attached Files:

  5. HARRY

    HARRY Active Member Licensed User

    derez,

    Many thanks for your help. Everything clear now. Strange that it worked to a certain extend without a HardKey object.

    Harry
     
  6. agraham

    agraham Expert Licensed User

    Not strange. You were trying with the very limited facilities built-in to a B4PPC Form which, as you found out, fails once an object that can accept the focus is placed on the form. The library provides a different and more complete mechanism for dealing with the Special Keys.
     
Loading...