Jump to content

Recommended Posts

Posted

Hi,

In the attachment, an example of how to use the OnKeyDown event with the KeyMap object of the Ext.panel.Panel in TUniFrame.

function beforeInit(sender, config)
{
   config.keyMap = {
        a: {
            handler: function() {
                Ext.Msg.alert('key pressed', 'you have pressed a');
            }
        },
        F2: {
            handler: function() {
              ajaxRequest(sender, '_F2', []);
            }
        },
        ESC: {
            handler: function() {
              ajaxRequest(sender, '_ESC', []);
            }
        },
        DELETE: {
            handler: function() {
              ajaxRequest(sender, '_DELETE', []);
            }
        }                
    }     
}

Demo

Regards,

Eduardo Belo

 

 

UniGUIFramesKeyEvents.rar

  • Like 3
  • Upvote 1
  • 4 weeks later...
Posted

Following this example How can I send ANY KEY PRESSED and the SENDER to Get in the FRAME ?

Ex: I click SPACE BAR in uniEDIT( named edCODIGO ) and in AJAXEVENT I Get it 

Posted

 

Hi Flávio!

I didn't quite understand your question, but maybe it will help you..

// UniEdit
function beforeInit(sender, config)
{
   config.keyMap = {
        SPACE: { // keyCode = 32
            handler: function() {
              ajaxRequest(sender, '_SPACE', []);
            }
        }                
    } 
}
procedure TMainForm.UniEdit1AjaxEvent(Sender: TComponent; EventName: string;
  Params: TUniStrings);
begin
  if EventName = '_SPACE' then
  begin
   InsertFrame(TUniFrame(TUniFrame1), 'Frame 1', True);
  end;
end;

Best regards,

Eduardo Belo

  • 10 months later...
Posted
3 hours ago, picyka said:

but how to use F3 for example, without triggering the browser shortcut.

\FMSoft\Framework\uniGUI\Demos\Desktop\MonitoredKeys

?

Posted
4 hours ago, Sherzod said:

\FMSoft\Framework\uniGUI\Demos\Desktop\MonitoredKeys

?

It really works well there, but if you take the AllFeatures Demo

Frame

UniFormControlsComboBox

Place the code

procedure TUniFormControlsComboBox.UniComboBox3KeyDown (Sender: TObject; var Key: Word; Shift: TShiftState);
begin
  case Key of
    VK_F1 .. VK_F12:
      ShowMessage ('test');
  end;
end;

pressing F3 will give the message, but it will call the browser's search.

Posted
5 hours ago, picyka said:

It really works well there, but if you take the AllFeatures Demo

pressing F3 will give the message, but it will call the browser's search.

Well, yes, you should analyze the demo example!
There are other settings.

1. MainForm.KeyPreview = True

2. MainForm.MonitoredKeys.Enabled=True,

    MainForm.MonitoredKeys.KeyEnableAll=False,

    MainForm.MonitoredKeys.KeyHandleAll=False

3. MainForm.MonitoredKeys.Keys[0]

        HandleBrowser=False

        KeyEnd=123

        KeyStart=112 

Posted
5 hours ago, Sherzod said:

Well, yes, you should analyze the demo example!
There are other settings. 

1. MainForm.KeyPreview = True

2. MainForm.MonitoredKeys.Enabled=True,

    MainForm.MonitoredKeys.KeyEnableAll=False,

    MainForm.MonitoredKeys.KeyHandleAll=False

3. MainForm.MonitoredKeys.Keys[0]

        HandleBrowser=False

        KeyEnd=123

        KeyStart=112 

I will test soon, thanks!

  • 2 years later...
Posted
23 minutes ago, Frederick said:

I have two TUniEdits on a frame. Using the above JS code, how do I get the ENTER key to work as a Tab from control to control?

Hello,

 

23 minutes ago, Frederick said:

Using the above JS code

Which one?

Posted

This one.

function beforeInit(sender, config)
{
   config.keyMap = {
        a: {
            handler: function() {
                Ext.Msg.alert('key pressed', 'you have pressed a');
            }
        },
        F2: {
            handler: function() {
              ajaxRequest(sender, '_F2', []);
            }
        },
        ESC: {
            handler: function() {
              ajaxRequest(sender, '_ESC', []);
            }
        },
        DELETE: {
            handler: function() {
              ajaxRequest(sender, '_DELETE', []);
            }
        }                
    }     
}
Posted
8 minutes ago, Frederick said:

I added the above code in my test project and I cannot seem to tab or press the ENTER key to move from one TUniEdit to another.

Yes, this code does not do what you want. You asked how we can capture Enter, and I answered.

And without this code, you can achieve what you want:

UniMainModule ->

image.png.c289d780ea1e30093491070f33ace4b5.png

Posted

I deleted the JS code in the BeforeInit event of the TUniFrame and set the properties of the above but the ENTER or Tab still does not move focus from one TUniEdit control to the next.

Remember, the two TUniEdit controls are on a TUniFrame and not in the TUniForm.

Posted
Just now, Frederick said:

Remember, the two TUniEdit controls are on a TUniFrame and not in the TUniForm.

Yes, I know. 

26 minutes ago, Frederick said:

myframe.7z 54.65 kB · 0 downloads

I will try to check your testcase. 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...