July 17, 2024, 07:04:44 PM


IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!

Move a control

Started by Andy, May 09, 2021, 12:29:28 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


May 09, 2021, 12:29:28 AM Last Edit: May 09, 2021, 04:45:14 AM by Andy

I was determined to post some code that would enable us all to move a control easily without us having to do calculations.

It came about when LarryMc mentioned that he might find it hard to drag a control to a specific location and that arrow keys would help.

So here are the functions and in this example I am detecting the keyboard arrow keys being pressed e.g. up / down etc and moving a control a specific amount in this case 20.

The functions are:


Parameters (three):

Window, ControlId, Amount of movement.

This works for a window with / without the @SIZE style.

The code is designed so that the control does not disappear from the window.

You could of course move the local variables / constants and make them global ones etc, but this way the code is portable and you should be able to use it in any of your programs.

I'm sure this will come in handy from time to time so I would suggest you grab yourself a copy!


Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.