VFP7 XPSP2
I have known lately that sending CTRL and "+"' to a grid or listview will
automatically adjust column width in the grid (Windows Shortcut).
how i can send CTRL and '+' using KEYBOARD in VFP?

I found this code to for C
SendKeys.Send ("^{+}");
http://www.codeproject.com/cs/miscctrl/AutoResize.asp
Thanks in advance

Re: send CTRL and "+" to application by Roger

Roger
Sat Oct 28 09:29:17 CDT 2006

"Samir Ibrahim" <samir.ibrahim@wilcopm.com> wrote in message
news:eTXTgnn%23GHA.4356@TK2MSFTNGP05.phx.gbl
> VFP7 XPSP2
> I have known lately that sending CTRL and "+"' to a grid or
> listview will automatically adjust column width in the grid (Windows
> Shortcut). how i can send CTRL and '+' using KEYBOARD in VFP?

You can do it with the keybd_event WinAPI function ...

#Define VK_CTRL 0x11
#Define VK_ADD 0x6B

Declare keybd_event In Win32API ;
Integer bVk, ;
Integer bScan, ;
Integer dwFlags, ;
Integer dwExtraInfo

* simulate pressing the CTRL
keybd_event(VK_CTRL,0,0,0)
* simulate pressing the '+' key
keybd_event(VK_ADD,0,0,0)
* simulate releasing the '+' key
keybd_event(VK_ADD,0,2,0)
* simulate releasing the CTRL key
keybd_event(VK_CTRL,0,2,0)

HTH,

Roger




Re: send CTRL and "+" to application by Bernhard

Bernhard
Sat Oct 28 09:30:30 CDT 2006

Hi Samir Ibrahim,

> I have known lately that sending CTRL and "+"' to a grid or listview will
> automatically adjust column width in the grid (Windows Shortcut).
> how i can send CTRL and '+' using KEYBOARD in VFP?
>
> I found this code to for C
> SendKeys.Send ("^{+}");
I don't know a native way to send this key combination.
But you could call
grid.autofit()
to autofit all visible columns.

Regards
Bernhard Sander

Re: send CTRL and "+" to application by AA

AA
Sat Oct 28 12:59:05 CDT 2006

In a VFP grid columnwidths can also be adjusted by clicking the upper left
corner area.
VFP doesn't register CTRL-'+' in the KeyPress event.
-Anders

"Samir Ibrahim" <samir.ibrahim@wilcopm.com> skrev i meddelandet
news:eTXTgnn%23GHA.4356@TK2MSFTNGP05.phx.gbl...
> VFP7 XPSP2
> I have known lately that sending CTRL and "+"' to a grid or listview
> will automatically adjust column width in the grid (Windows Shortcut).
> how i can send CTRL and '+' using KEYBOARD in VFP?
>
> I found this code to for C
> SendKeys.Send ("^{+}");
> http://www.codeproject.com/cs/miscctrl/AutoResize.asp
> Thanks in advance
>
>



Re: send CTRL and "+" to application by Samir

Samir
Mon Oct 30 04:09:35 CST 2006

Thx all for the answes, actually it is my mistake not to determine that i am
using Listview not VFP Grid.
I have found a trick on VB site, that you can make the Listview auto width
adjustment. i convert it to vfp code and it works perfectly although i
didnot understand how it works, Who cares :)

DECLARE INTEGER SendMessage IN user32;
INTEGER hWnd,;
INTEGER Msg,;
INTEGER wParam,;
INTEGER lParam

SET_COLUMN_WIDTH = 4126
AUTOSIZE_USEHEADER = -1 && this will make the listview autofit with
longest data in listview whixh has the same effect of sending CTRL and +
* AUTOSIZE_USEHEADER = -2 && this will make the listview autofit with the
header size
lnListViewCC = thisform.olistview.ColumnHeaders.Count
ctrlHwnd = Thisform.oListview.hWnd
FOR I = 0 TO lnListViewCC - 1
= SendMessage(Thisform.oListview.hWnd , SET_COLUMN_WIDTH,
I,@AUTOSIZE_USEHEADER)
NEXT I

Samir Ibrahim

"Samir Ibrahim" <samir.ibrahim@wilcopm.com> wrote in message
news:eTXTgnn%23GHA.4356@TK2MSFTNGP05.phx.gbl...
> VFP7 XPSP2
> I have known lately that sending CTRL and "+"' to a grid or listview
> will automatically adjust column width in the grid (Windows Shortcut).
> how i can send CTRL and '+' using KEYBOARD in VFP?
>
> I found this code to for C
> SendKeys.Send ("^{+}");
> http://www.codeproject.com/cs/miscctrl/AutoResize.asp
> Thanks in advance
>
>



Re: send CTRL and "+" to application by Jim

Jim
Mon Oct 30 06:34:17 CST 2006


You should be able to use the 'keyboard' command to send keystrokes to
your form. I use it in methods in 7.0, 8.0 and 9.0 and it works fine.
Note that this isn't really recommended though.


Re: send CTRL and "+" to application by Bernhard

Bernhard
Mon Oct 30 07:20:11 CST 2006

Hi Jim,

> You should be able to use the 'keyboard' command to send keystrokes to
> your form. I use it in methods in 7.0, 8.0 and 9.0 and it works fine.
> Note that this isn't really recommended though.
And you can not send every key combination with KEYBOARD. Ctrl+plus is such a
combination you can not send with KEYBOARD.

Regards
Bernhard Sander

Re: send CTRL and "+" to application by Josh

Josh
Mon Oct 30 09:33:03 CST 2006

When doing keyboard commands -- be sure to clear out the keyboard buffer 1st.

On 30 Oct 2006 04:34:17 -0800, "Jim Czeb" <james.czebiniak@pearlcarroll.com>
wrote:

>
>You should be able to use the 'keyboard' command to send keystrokes to
>your form. I use it in methods in 7.0, 8.0 and 9.0 and it works fine.
>Note that this isn't really recommended though.


--- AntiSpam/harvest ---
Remove X's to send email to me.