PC SOFT

PROFESSIONAL NEWSGROUPS
WINDEVWEBDEV and WINDEV Mobile

Home → WEBDEV 2024 → Determine whether a position on screen is occupied ?
Determine whether a position on screen is occupied ?
Started by Stef, Mar., 26 2013 1:12 PM - 2 replies
Registered member
45 messages
Posted on March, 26 2013 - 1:12 PM
I use code that moves controls around on pages at runtime.
Now I want to prevent controls to be moved to an area of the page that is already taken up by another control and calculate an alternative location if the first one is taken.

Is there a command that wil 'scan' a screen area to check if it is not empty ?
I cannot find such a command in the help files, maybe one of you has a way of dealing with this ?
Thx
Posted on March, 26 2013 - 3:03 PM
Hi Stef

there are several ways of doing this...

One is to use the Enumxxxx functions to go through all the controls, and
check position and size to see if there is a conflict

Another is to KEEP in an array (by example) the position and size of all
control (as YOUR code is moving them around, YOUR code can also record
what its doing) and check against that...

Finally, it MAY be possible to do it by checking the color of the pixel
on the screen BUT that would mean that it would have to be different
from the color of your controls...

Best regards


--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

More information on http://www.fabriceharari.com


On 3/26/2013 6:23 AM, Stef wrote:
I use code that moves controls around on pages at runtime.
Now I want to prevent controls to be moved to an area of the page that is already taken up by another control and calculate an alternative location if the first one is taken.

Is there a command that wil 'scan' a screen area to check if it is not empty ?
I cannot find such a command in the help files, maybe one of you has a way of dealing with this ?
Thx
Registered member
45 messages
Posted on April, 02 2013 - 10:35 AM
Hi Fabrice,

I had already been experimenting with the pixel colors but this means I have to check a large number of pixels, being width*height of the area where a control needs to be moved to, and this for multiple possible colors (text color, background color, edge color, caption color...).
As I was already using an array to store several other properties of the edit controls I expanded the array storing X and Y positions. As width and heigth are known values I can now calculate/check positions.
Thx