Skip to main content
Hello everybody,
 
I have to build a new form with a painted html widget for to replace an older form.
This form offers some user actions, which can be started with userkey combinations.
 
I know that I can bring uniface to handle the key combinations rather than the html widget:

sProperties = $properties(HTML1)    
putitem/id sProperties, "UnifaceKeys", "ctrl+2ctrl+4ctrl+6ctrl+7ctrl+8ctrl+9"    
$properties(HTML1) = sProperties

The "" is <GOLD><SEMICOLON>

This works fine so far. But in our legacy application there are 2 special key combinations... 
It's both the combination of "ctrl" with the division key and "ctrl" with the multiplication key of the numeric keyboard.
 
Does anybody of you know how state these key combinations in order to give uniface control  for them with the "UnifaceKeys" property?
 
Thanks in advance and best regards



------------------------------
Michael Rösch
Abrechnungszentrum Emmendingen
------------------------------

Hello everybody,
 
I have to build a new form with a painted html widget for to replace an older form.
This form offers some user actions, which can be started with userkey combinations.
 
I know that I can bring uniface to handle the key combinations rather than the html widget:

sProperties = $properties(HTML1)    
putitem/id sProperties, "UnifaceKeys", "ctrl+2ctrl+4ctrl+6ctrl+7ctrl+8ctrl+9"    
$properties(HTML1) = sProperties

The "" is <GOLD><SEMICOLON>

This works fine so far. But in our legacy application there are 2 special key combinations... 
It's both the combination of "ctrl" with the division key and "ctrl" with the multiplication key of the numeric keyboard.
 
Does anybody of you know how state these key combinations in order to give uniface control  for them with the "UnifaceKeys" property?
 
Thanks in advance and best regards



------------------------------
Michael Rösch
Abrechnungszentrum Emmendingen
------------------------------

I've just figured out that the solution with the "UnifaceKeys" doesn't work completely proper for my purposes. 
Maybe it's possible to catch the keys and fire window.unifaceTriggers... I will see...



------------------------------
Michael Rösch
Abrechnungszentrum Emmendingen
------------------------------

I've just figured out that the solution with the "UnifaceKeys" doesn't work completely proper for my purposes. 
Maybe it's possible to catch the keys and fire window.unifaceTriggers... I will see...



------------------------------
Michael Rösch
Abrechnungszentrum Emmendingen
------------------------------

I've found a solution which works much better:

Add some javascript code to my HTML...

    document.addEventListener('keydown', function(event) {
        if (event.ctrlKey && event.key === '9') {
            //alert('event.ctrlKey: ' + event.ctrlKey + ' event.key: ' + event.key);
            window.unifaceTriggers('keyCombination', "STRG+9");
        }
        if (event.ctrlKey && event.key === '7') {
            //alert('event.ctrlKey: ' + event.ctrlKey + ' event.key: ' + event.key);
            window.unifaceTriggers('keyCombination', "STRG+7");            
        }  
    });

add a uniface trigger:

trigger keyCombination

	params
		string  psKeyCombination : IN 
	endparams

	selectcase $uppercase(psKeyCombination)
		case "STRG+9"
                   ; doSomething...
		case "STRG+7"
                   ; doSomethingOther...
	endselectcase

end ; 


Seems to work really fine :-)

Best regards




------------------------------
Michael Rösch
Abrechnungszentrum Emmendingen
------------------------------