BoxMapMode

 

Sets the mapping mode for a WinBatch box.

Syntax:

BoxMapMode(box ID, map mode)

Parameters:

(i) box ID the ID number of the desired WinBatch box.

(i) map mode @ON to map coordinates to client scale (default). One Unit is 1/1000 (or 0.1%) of the size of the current box. @OFF for screen scale. One unit is 1/1000 (or 0.1%) of the size of the screen.

Returns:

(i) @TRUE on success; @FALSE on failure.

 

BoxMapMode defines how a functions "coordinate" parameters will be interpreted. The default setting, @ON, allows WinBatch boxes to automatically resize themselves per the user's monitor adjustments. In the default "mapping" mode each window is assumed to be 1000x1000. This makes it easy to write a WinBatch program that will run on anybody's screen.

Note: The Default setting is highly recommended.

 

Example:

;; sample script for BoxMapMode
IntControl(12,5,0,0,0)
title="BoxMapMode Example"
BoxesUp("100,100,900,900",@ZOOMED)
BoxMapmode(1,1) ; Default map mode
BoxColor(1,"255,255,0",0)
BoxPen(1,"0,0,255",10)
BoxTextFont(1, "", 30, 0, 0)
BoxTextColor(1,"0,0,0")
BoxDrawRect(1,"50,50,150,150",1)
BoxDrawCircle(1,"200,50,350,150",1)
BoxDrawLine(1,"400,100,500,100")
BoxDrawLine(1,"450,50,450,150")
BoxDrawText(1, "50,160,500,190", "Map Mode = 1 Using sizes based on window", 0, 0)
BoxMapmode(1,0)
BoxColor(1,"255,255,0",0)
BoxPen(1,"0,0,255",10)
BoxTextFont(1, "", 30, 0, 0)
BoxDrawRect(1,"50,200,150,300",1)
BoxDrawCircle(1,"200,200,350,300",1)
BoxDrawLine(1,"400,250,500,250")
BoxDrawLine(1,"450,200,450,300")
BoxDrawText(1, "50,310,500,340", "Map Mode = 0 Using sizes based on screen",0, 0)
Message(title,"Note that both sets of objects look pretty much the same.")
WinPlace(0,0,750,750,"")
Message(title,"Note that when we changed the size of the window the MapMode=1 object were resized proportionally, whileas the MapMode=0 objects stayed the same.")
WinPlace(0,0,500,500,"")
Message(title,"MapMode=1 objects resized again.")
WinPlace(0,0,200,1000,"")
Message(title,"Note that while most objects scale reasonably well, fonts are based on Window height.")
WinPlace(0,0,1000,200,"")
Message(title,"Giving us teeny tiny fonts in this sort of Window.")
WinPlace(50,50,950,950,"")
BoxMapmode(1,1) ; Default map mode
BoxTextFont(1, "", 30, 0, 0)
BoxTextColor(1,"255,0,0")
BoxDrawText(1,"50,500,500,700","Resize the window with the mouse and watch what happens. Hit ESC when you are done. (This message drawn with MapMode=1)",0,16)
WaitForKey("{ESC}","","","","")

See Also:

BoxesUp, BoxNew