Insert contents of variable into edit field while entering data. XPA 3.3


Graham White
 

Hi,

 

I want to implement functionality similar to the Windows Paste (Ctrl-V) within a edit field in an XPA Program.  I want the user to be in an edit field entering data and then be able to press a key (e.g. F6) that would then trigger an event to paste the contents of a variable into the field where the cursor is and then allow them to continue entering more data In the field.  I know I could put the contents of the field in the clip board where Ctrl-V would paste it but that wouldn’t work if they overwrote the clipboard. 

 

Has anyone achieved this within XPA?

 

Regards

 

Graham White
Software Developer
Graham.White@...
EC Credit Control |  eccreditcontrol.com

 

IMPORTANT NOTICE: This e-mail message and any attachments are confidential to EC Credit Control and subject to legal privilege (which is not waived or 

lost by mistaken delivery). If you have received this e-mail in error, please advise the sender immediately and destroy the message and any attachments.  

If you are not the intended recipient you are notified that any use, distribution, amendment, copying or any action taken or omitted to be taken in reliance of 

this message or attachments is prohibited. EC Credit Control collects personal information to provide and market our services (see our privacy policy at: 

www.eccreditcontrol.co.nz – www.eccreditcontrol.com - www.eccreditcontrol.com.au for more information about use, disclosure and access). 

EC Credit Control’s liability in connection with transmitting, unauthorised access to, or viruses in this message and its attachments is limited to resupply of 

any affected message or attachments.


Andy Jerison
 

Look at EditGet() and, if I remember right, EditSet(). You'd use an expression like this: EditSet(Trim(EditGet()) + Trim(MyVar)). I can't remember the concatenation operator — replace my plus sign with it. 


On Mon, Nov 30, 2020, 21:41 Graham White <graham.white@...> wrote:

Hi,

 

I want to implement functionality similar to the Windows Paste (Ctrl-V) within a edit field in an XPA Program.  I want the user to be in an edit field entering data and then be able to press a key (e.g. F6) that would then trigger an event to paste the contents of a variable into the field where the cursor is and then allow them to continue entering more data In the field.  I know I could put the contents of the field in the clip board where Ctrl-V would paste it but that wouldn’t work if they overwrote the clipboard. 

 

Has anyone achieved this within XPA?

 

Regards

 

Graham White
Software Developer
Graham.White@...
EC Credit Control |  eccreditcontrol.com

 

IMPORTANT NOTICE: This e-mail message and any attachments are confidential to EC Credit Control and subject to legal privilege (which is not waived or 

lost by mistaken delivery). If you have received this e-mail in error, please advise the sender immediately and destroy the message and any attachments.  

If you are not the intended recipient you are notified that any use, distribution, amendment, copying or any action taken or omitted to be taken in reliance of 

this message or attachments is prohibited. EC Credit Control collects personal information to provide and market our services (see our privacy policy at: 

www.eccreditcontrol.co.nz – www.eccreditcontrol.com - www.eccreditcontrol.com.au for more information about use, disclosure and access). 

EC Credit Control’s liability in connection with transmitting, unauthorised access to, or viruses in this message and its attachments is limited to resupply of 

any affected message or attachments.


Graham White
 

Hi Andy,

That kind of works except in my test EditGet() contains the whole contents of the edit field.  So.. if I enter 12345678 and then move the cursor between 4 and 5 and do the EditGet() i get 12345678 but what I want is to paste my field between the 4 and 5.

regards
Graham


Keith Canniff
 

Graham,

So I guess I'm confused on what you want to use to paste with. But let's try this...

You could have a memory table of just numbers (let's say 1-1000), that when the user presses F6, the memory table appears and you use varname(record number), catcher(record number) which shows the name of every field in the memory stack and it's cause. The users selects the value they want, and in takes suffix of the memory pick list raise an event of KBPUT(value selected from the list) which will inset the value into the last cursor position of the field they were in before pressing F6. 

If you want the value from the clipboard, you could add a button to the pick list program to copy the clipboard instead

Keith


From: main@magicu-l.groups.io <main@magicu-l.groups.io> on behalf of Graham White <graham.white@...>
Sent: Monday, November 30, 2020 9:54:46 PM
To: main@magicu-l.groups.io <main@magicu-l.groups.io>
Subject: Re: [magicu-l] Insert contents of variable into edit field while entering data. XPA 3.3
 
Hi Andy,

That kind of works except in my test EditGet() contains the whole contents of the edit field.  So.. if I enter 12345678 and then move the cursor between 4 and 5 and do the EditGet() i get 12345678 but what I want is to paste my field between the 4 and 5.

regards
Graham


Callum@...
 

Hi Graham,

This could get a bit messy but you could try something along the lines of, in your F6 event:

Save the current clipboard to a blob (ClipRead function)
Overwrite the clipboard with the data you want to insert (ClipWrite / ClipAdd functions)
Raise a paste event (hopefully, now you have the end result you wanted...)

Then to be polite but the original clipboard back from the blob you saved it to in the first step.  Not sure if this would work in the F6 event or you may have to do it when the user exits the control...
Worth a shot...


jaceks@...
 

Hi Graham,

this should do that:

Ins(EditGet(),'AAA',CaretPosGet(),Len('AAA'))

Regards
Jacek


Graham White
 

Thanks Jacek that does the trick.  I now just have to figure out how to move the cursor to postion it after the inserted field because it returns to the beginning of the field.

Regards
Graham


Andy Jerison
 

You know its initial position and how many characters you've inserted. All you have to do is raise the right number of next character events. 


On Tue, Dec 1, 2020, 14:50 Graham White <graham.white@...> wrote:
Thanks Jacek that does the trick.  I now just have to figure out how to move the cursor to postion it after the inserted field because it returns to the beginning of the field.

Regards
Graham


Graham White
 

Perfect.  Thanks Andy

Regards
Graham