Image/Pixel-Color Operations

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Image/Pixel-Color Operations > Additional Commands >

Image/Pixel-Color Operations

QFR. - Quadrant from RECT

Previous Top Next


MiniRobotLanguage (MRL)

 

QFR. Command

Get Quadrant Coordinates from Rect

 

 

Intention

 

The QFR-Command will take any Rectangular Area, and calculate the Coordinates of a Quadrant-Rect inside of this Area.

This can be used to locate graphical Elements in a form, control or any part of a form.

 

QFR. understands Quadrant Coordinates, see 3.6 Using Quadrant-Coordinates .

It will take the last localized Object as base for the Quadrants. This way, you can split any type of objects or control in an resolution independent way into 16 Quadrants.

 

Depending on the Parameters you will normally use a 4x4 Quadrant-System.

Using the optional Parameter P5, QFR. can handle any Quadrant-System from 2x2 to 9x9.

 

The command is in a way designed that you can then use the result-from QFR. as Input for another QFR (nested Quadrants).

 

What is a Quadrant?

In the following picture you can see the Quadrants of a Topwindow.

 

What is a Quadrant good for?

Quadrants are resolution-independent. If you can click Buttons using Quadrants, the result will be resolution independent, as the original rectangle (for example a Top-Window) will always be divided into the same amount of Quadrants..

Using the "o{..}"-Option, you can split Elements that have been located, for example in a Treeview, or custom Control.

This way you can click parts of controls that can not be subdivided in other ways.

 

Quadrant_New

 

 

This are the 4x4 Quadrants of a Window. They range from A1 to D4.

 

How do i Click into a Quadrant?

You can use the GRM.-.Command to calculate the Middle-Point inside the Quadrant.
Here is an example.

 

QFR.|{A1}|$$REC

GRM.$$REC|$$MID

MMV.$$MID

 

Can i combine multiple Quadrants into one?

You can combine multiple Quadrants, note that the resulting Quadrant will always be rectangular.

For example, if you combine {A1} and {B2} then the resulting Quadrant will automatically also include {A2} and {B1}.

Because the result needs to be rectangular. Technically you would write:

 
QFR.|{A1,B2}|$$REC

 

To combine these two Quadrants. Note that there is no limit on how many Quadrants you wish to combine.

 

QFR.|{A1,B2,C3,D3}|$$REC

 

Will also work as expected.

 

Can i combine multiple QFR-Calls into one?

You can combine multiple Calls into one. For this you can just enter the Quadrants in a sequential way.

 

QFR.|{A1}{B1}|$$REC

 

Will calculate Quadrant A1, and then inside A1 calculate the Quadrant B1.

 

' This is a nested QFR. it will calculate a Quadrant D4 inside a Quadrant D3,D4.

QFR.100,100,500,500|{D4}{D3,D4}|$$RES

MBX.$$RES

 

' This is the same like the statement above in two QFR.-Calls

QFR.100,100,500,500|{D4}|$$RES

QFR.$$RES|{D3,D4}|$$RES

MBX.$$RES

 

In both cases this is the result.

 

2017-02-06 18_15_29-Message_Nachricht_

 

 

How do I specify the Source-Rectangle, from which the Quadrants are calculated?

There are multiple ways to specify them.

 

1. Variation: Just specify nothing. Doing so, QFR. will take the last localized Rectangle (window or whatever).
Note that often Windows are moved after they have been localized. In such case this version of QFR. may use the "old" coordinates before the window was moved!

QFR.|{A1,A2}|$$REC|4

 

2. Variation: Specify "c","w","t" or Combinations of these.
Doing so, QFR. will take the last localized window "w", "t"-Top-Window and/or the "c"-Client-Coordinates of these windows.

Specifying just "c" will use the Client Coordinate of whatever window that was last localized.
Unlike Variation 1, this Variation will calculate the most actual window coordinates at the time of the Call to QFR..

QFR.tc|{A1,A2}|$$REC|4

QFR.wc|{A1,A2}|$$REC|4

QFR.t|{A1,A2}|$$REC|4

QFR.w|{A1,A2}|$$REC|4

QFR.c|{A1,A2}|$$REC|4

 

3. Variation: Specify just the Screen-Coordinates of the Rectangle.

 

QFR.0,0,400,400|{A1,A2}|$$REC|4

' Result 0,0,100,200

 

4. Variation: Specify "w","t","c" and the Screen-Coordinates of the Rectangle.

 

 ' Now the Coordinates are relative to the last located window.

QFR.w0,0,400,400|{A1,B1}|$$REC|4

 

5. Variation: Specify "w","t","c" and the Quadrant of the last localized window/Top-Window/Client-Area or Object.

' Now the Coordinates are relative to the last located
' Top-Window or Window or Client-Area or Object of these.
QFR.o{A1,A2}|{A1}|$$REC|4

QFR.tc{A1}|{A1,B2}|$$REC|4

QFR.w{A1}{A2-A4}|{A1,B2}|$$REC|4

 

More Examples:

 
QFR.0,0,400,400|{A1,A2,B2}|$$REC|4

' Result 0,0,200,200

 

' Return complete Windows-Rect (like GAR.)

STW.tc|PB|Testap

QFR.|{A1,D4}|$$REC

MBX.$$REC

' Get the Midpoint of that RECT

GRM.$$REC|$$MID

MBX.$$MID

 

QFR. can be used to get the Coordinates for other Pixel-Operations like:

 

ILC. / NLC. - If Line Color

IRA. / NRA. - If Rect altered

RRA. - Remember Rectangular Area

and all such commands.

 

 

Syntax

 

 

QFR.[P1][|P2][|P3][|P4]

 

 

Parameter Explanation

 

P1  - (optional) "t","w","c" or Combinations of these.
      And/or an Input-Rectangle. Format is: x1,y1,x2,y2 if omitted, it will use the actual window or object rectangle.
      Or you can specify Quadrant coordinates like {A1}.In such case these Coordinates are Screen-Coordinates unless
      you prefix them with "t","w" or "c" or Combiantions of these.  

      If Parameter is omitted, it will take the last localized Object-rectangle as base for the Quadrants.

      Generally the given coordinates stay in the Source-Coordinate-System.
      If you input window-coordinates, the command will output window-relative coordinates.

 

P2  - (optional) Variable that contains the Quadrant(s) to compute the coordinates for.

   QFR. uses the 3.6 Using Quadrant-Coordinates.
       Can be something like: {A1} or {A2,A4} or {D4} or multiple of these.

         If you specify  multiple Quadrants like {A1}{A2,A4}{D4} then the command will use the result of the first calculation
         as Input for the next calculation.
         This way you can split Quadrants in smaller pieces and calculate "B4 inside of D4". There is no depth limit other
         then a mathematical. If you omit P2, the command will use {A1,D4}.  

 

P3 - (optional) Variable for the result. If omitted, TOS is used.

 

P4 - (optional) Using the optional Parameter P4, QFR. can handle any Quadrant-System from 2x2 to 9x9

      To use Quadrants that are divided by 8, you would specify an "8".

   QFR.w0,0,400,400|{A1}|$$REC|8

 

 

Example

 

' Use the Testapplication

STW.ct|PBWindowClass:0|TestApp

QFR.|{A1,D4}|$$LAA

GAR.$$LAB

MBX.$$LAA-$$LAB

ENR.

 

'-----------------------

' Listbox-Element will be divided in Quadrants
'

STW.ct|PBWindowClass:0|TestApp

SCW.nict|1|1029|ListBox|List-Item Nr.1

' Possible Commands are: LBE. (see help) | AGR.

LBE.List-Item Nr.6

' Holt Rect von Listbox

QFR.o{A1}|{A1-A4}|$$REC|4

' and move Mouse there

GRM.$$REC|$$MID

MMV.$$MID

 

 

 

Remarks

 

-

 

 

Limitations:

 

-

 

 

 

See also:

 

3.6 Using Quadrant-Coordinates

VAC. - Variable reCt

1.8. Selecting the Application (Topwindow)

ILC. / NLC. - If Line Color

IRA. / NRA. - If Rect altered

RRA. - Remember Rectangular Area

CST. - Coordinate System Transform

GAR. - Get actual Rectangle

MAP. - Move Active Point