programmable virtual keyboard development

Osborne

Active Member
I am not sure, but are you missing running System.Windows.Forms.Application:Exit().?

As a rule, on a multi .NET window session the first program in the stack has two lines that are run when the program has loaded and when it quits.

Once loaded you have the line:
Code:
WAIT-FOR System.Windows.Forms.Application:Run().

When quitting make sure you run:
Code:
System.Windows.Forms.Application:Exit().
 

borhane

Member
Arr, so you are using the 'ABL Virtual Keyboard'. Alter the 'layer', 'row' and 'pos' attributes.

Code:
  <keyboard key-label="SHIFT+F1" shift-key="true" key-value="112" layer="1" row="1" pos="1">
    <width>61</width>
    <height>58</height>
    <indent>0</indent>
    <image-up/>
    <image-dwn/>
  </keyboard>

The key-value="112", 112 is the decimal representation of the HEX value of 0x70. 0x70 is the F1 key.

Notice how the shift-key="true" is set to true.

The image-up & image-dwn elements are not yet implemented. The idea that the button will show an image rather than the text.

REF:
Virtual-Key Codes
hello how i can display a picture in a button Cecil ???? thank you in advance for your help
 

Cecil

19+ years progress programming and still learning.
Add this code to the 'createLayout' procedure in the DynamicKeyboard.w after the button has been created.

IF keyboard.imageUp NE "" AND SEARCH(keyboard.imageUp) NE "" THEN
but1:LOAD-IMAGE-UP(SEARCH(keyboard.imageUp)).

IF keyboard.imageDown NE "" AND SEARCH(keyboard.imageDown) NE "" THEN
but1:LOAD-IMAGE-DOWN(SEARCH(keyboard.imageDown)).

In the XML keyboard layout files updat the nessary image-up and image-down elements with the releative filename of the iemage you want to use.
 

borhane

Member
Add this code to the 'createLayout' procedure in the DynamicKeyboard.w after the button has been created.



In the XML keyboard layout files updat the nessary image-up and image-down elements with the releative filename of the iemage you want to use.
thank you Cecile for your help I can prove where the anomaly is in this XML code

<keyboard key-label="" shift-key="false" ctrl-key="True" alt-key="false" key-value="{F2}" layer="2" row="2" pos="4">
<special-lKey/>
<key-value-Literal/>
<width>154</width>
<height>77</height>
<indent>0</indent>
<sensitive>true</sensitive>
<image-Up>"D:\CAMELEON\SOURCES\front\cercle2.gif"</image-up>
<image-dwn/>
</keyboard>
 

Cecil

19+ years progress programming and still learning.
thank you Cecile for your help I can prove where the anomaly is in this XML code

<keyboard key-label="" shift-key="false" ctrl-key="True" alt-key="false" key-value="{F2}" layer="2" row="2" pos="4">
<special-lKey/>
<key-value-Literal/>
<width>154</width>
<height>77</height>
<indent>0</indent>
<sensitive>true</sensitive>
<image-Up>"D:\CAMELEON\SOURCES\front\cercle2.gif"</image-up>
<image-dwn/>
</keyboard>
I don't believe the image path location needs to be in quotes.
 

chrisds

New Member
well, i did once and its very long coding. Here some snips :


Code:
DEFINE VARIABLE key_ent AS CHARACTER FORMAT "x(1)".
DEFINE VARIABLE full_keys AS CHARACTER FORMAT "x(50)".

DEFINE BUTTON kb_a label "A"
TRIGGERS
     ON CHOOSE key_ent = "A".
END TRIGGERS.

DEFINE BUTTON kb_b label "B"
TRIGGERS
     ON CHOOSE key_ent = "B".
END TRIGGERS.

FORM
    kb_a kb_b
WITH FRAME key_board THREE-D ATTR-SPACE OVERLAY SIZE 40 BY 1 ROW 19 COLUMN 10 NO-BOX NO-LABELS .

full_keys = "".

ENABLE ALL WITH FRAME key_board.
REPEAT :      
            WAIT-FOR CHOOSE OF kb_a kb_b IN FRAME key_board.
            full_keys = full_keys + key_ent.
END.

DISABLE ALL WITH FRAME key_board.
HIDE FRAME key_board.

DISPLAY CAPS(TRIM(full_keys)).


 

borhane

Member
well, i did once and its very long coding. Here some snips :


Code:
DEFINE VARIABLE key_ent AS CHARACTER FORMAT "x(1)".
DEFINE VARIABLE full_keys AS CHARACTER FORMAT "x(50)".

DEFINE BUTTON kb_a label "A"
TRIGGERS
     ON CHOOSE key_ent = "A".
END TRIGGERS.

DEFINE BUTTON kb_b label "B"
TRIGGERS
     ON CHOOSE key_ent = "B".
END TRIGGERS.

FORM
    kb_a kb_b
WITH FRAME key_board THREE-D ATTR-SPACE OVERLAY SIZE 40 BY 1 ROW 19 COLUMN 10 NO-BOX NO-LABELS .

full_keys = "".

ENABLE ALL WITH FRAME key_board.
REPEAT :     
            WAIT-FOR CHOOSE OF kb_a kb_b IN FRAME key_board.
            full_keys = full_keys + key_ent.
END.

DISABLE ALL WITH FRAME key_board.
HIDE FRAME key_board.

DISPLAY CAPS(TRIM(full_keys)).


Thank you very much my problem is solved by Cecil
 

borhane

Member
well, i did once and its very long coding. Here some snips :


Code:
DEFINE VARIABLE key_ent AS CHARACTER FORMAT "x(1)".
DEFINE VARIABLE full_keys AS CHARACTER FORMAT "x(50)".

DEFINE BUTTON kb_a label "A"
TRIGGERS
     ON CHOOSE key_ent = "A".
END TRIGGERS.

DEFINE BUTTON kb_b label "B"
TRIGGERS
     ON CHOOSE key_ent = "B".
END TRIGGERS.

FORM
    kb_a kb_b
WITH FRAME key_board THREE-D ATTR-SPACE OVERLAY SIZE 40 BY 1 ROW 19 COLUMN 10 NO-BOX NO-LABELS .

full_keys = "".

ENABLE ALL WITH FRAME key_board.
REPEAT :    
            WAIT-FOR CHOOSE OF kb_a kb_b IN FRAME key_board.
            full_keys = full_keys + key_ent.
END.

DISABLE ALL WITH FRAME key_board.
HIDE FRAME key_board.

DISPLAY CAPS(TRIM(full_keys)).


Thank you very much my problem is solved by Cecil
 

borhane

Member
how can i solve this problem please here is the code
1618670310966.png

ASSIGN CURRENT-WINDOW = {&WINDOW-NAME}
THIS-PROCEDURE:CURRENT-WINDOW = {&WINDOW-NAME}.

ON CLOSE OF THIS-PROCEDURE
RUN disable_UI.
/* Best default for GUI applications is... */
PAUSE 0 BEFORE-HIDE.



/********************/
MAIN-BLOCK:
DO ON ERROR UNDO MAIN-BLOCK, LEAVE MAIN-BLOCK
ON END-KEY UNDO MAIN-BLOCK, LEAVE MAIN-BLOCK:
RUN enable_UI.
VIEW FRAME FRAME-F.
RUN "D:\CAMELEON\SOURCES\front\DynamicKeyboard.w" PERSISTENT SET virtualKeyboard ( INPUT FRAME {&frame-name}:HANDLE,
INPUT FRAME FRAME-F:HANDLE).
 

Osborne

Active Member
It is difficult to tell as you have not posted the full code. That message can appear if you try to run this single line of code and a .NET specific WAIT-FOR does not exist:
Code:
System.Windows.Forms.SendKeys:Send("a").

1618819499104.png
The following is an example of SendKeys and using a .NET specific WAIT-FOR:
Code:
DEF VAR A AS CHAR.

DEF BUTTON b1a LABEL "a" NO-FOCUS.
DEF BUTTON b1b LABEL "b" NO-FOCUS.
DEF BUTTON b1c LABEL "c" NO-FOCUS.
DEF BUTTON b1d LABEL "d" NO-FOCUS.
DEF BUTTON b1e LABEL "e" NO-FOCUS.
DEF BUTTON b2 LABEL "Home" NO-FOCUS.
DEF BUTTON b3 LABEL "Left" NO-FOCUS.
DEF BUTTON b4 LABEL "Right" NO-FOCUS.
DEF BUTTON b5 LABEL "End" NO-FOCUS.

DEF FRAME f a SKIP
    b1a b1b b1c b1d b1e SKIP b2 b3 b4 b5 SKIP
    SPACE(4) .

DISPLAY a WITH FRAME f.
ENABLE ALL WITH FRAME f.

ON CHOOSE OF b1a IN FRAME f
DO:
    System.Windows.Forms.SendKeys:Send("a").
END.

ON CHOOSE OF b1b IN FRAME f
DO:
    System.Windows.Forms.SendKeys:Send("b").
END.

ON CHOOSE OF b1c IN FRAME f
DO:
    System.Windows.Forms.SendKeys:Send("c").
END.

ON CHOOSE OF b1d IN FRAME f
DO:
    System.Windows.Forms.SendKeys:Send("d").
END.

ON CHOOSE OF b1e IN FRAME f
DO:
    System.Windows.Forms.SendKeys:Send("e").
END.

ON CHOOSE OF b2 IN FRAME f
DO:
    System.Windows.Forms.SendKeys:Send("~{Home}").
END.

ON CHOOSE OF b3 IN FRAME f
DO:
    System.Windows.Forms.SendKeys:Send("~{LEFT}").
END.

ON CHOOSE OF b4 IN FRAME f
DO:
    System.Windows.Forms.SendKeys:Send("~{RIGHT}").
END.

ON CHOOSE OF b5 IN FRAME f
DO:
    System.Windows.Forms.SendKeys:Send("~{END}").
END.

WAIT-FOR System.Windows.Forms.Application:Run().
 

Cringer

ProgressTalk.com Moderator
Staff member
You can't. Not with a standard alert box. You could code a custom .net MessageForm with your desired dimensions - we use those because you can expand them to include a lot of information that an Alert Box doesn't.
 

borhane

Member
You can't. Not with a standard alert box. You could code a custom .net MessageForm with your desired dimensions - we use those because you can expand them to include a lot of information that an Alert Box doesn't.
thank you very much Cringer
 

wa4qms

New Member
ABL way is to:

Code:
APPLY "SHIFT-F1" TO widget-handle.

Utilising WinAPI method:


Code:
        &SCOPED-DEFINE KEYSHIFT 0x10
        &SCOPED-DEFINE KEYF1 0x70
        &SCOPED-DEFINE KEYPRESDOWN 0x01
        &SCOPED-DEFINE KEYPRESUP 0x02
       
        DEFINE VARIABLE retCode AS INTEGER     NO-UNDO.
       
           
       
        RUN keybd_event ({&KEYSHIFT}, 0, 0, 0, OUTPUT retCode).      
        RUN keybd_event ({&KEYF1}, 0, 0, 0, OUTPUT retCode).
        RUN keybd_event ({&KEYF1}, 0, {&KEYPRESUP}, 0, OUTPUT retCode).
        RUN keybd_event ({&KEYSHIFT}, 0, {&KEYPRESUP}, 0, OUTPUT retCode).
I just saw this older post and if I works for what I need, go grab yourself a beer and send me the bill.
-Dennis-
 
Top