Viewport Related Methods
Concept of Viewports
Viewports are user-defined screen areas which have their own coordinates, width, height and orientation.
Additional to the main viewport 0 (entire main screen) for all screens, you may define up to 8
viewports (1-8) in a project. They may overlap each other, but consider that they don't have independent
memory areas. Therefore, a viewport may overwrite the content of an overlapping other one without saving
the underlying area.
All methods (except the Class Memory)
executed within a viewport refer to the viewport's size and cursor position. So, for example,
getDisplaySize() returns the height and width of the current viewport,
not the entire screen. Text wrapping and scrolling as well as cropping of graphics is also done in the
selected viewport's area.
All defined viewports have their own set of attributes
(see Class Attribute).
So when switching from viewport 1 to viewport 2 and outputting text in both of them, it shows up on the
cursor position and with the colors and attributes of the respective viewport.
Note
Example
General.resetAll();
Control.setCursorPosition(30,130); // set cursor position to 30/130
Control.defineViewport(1, 0, 65, 50); // define viewport 1 with size of 65x50
Control.setCursorPosition(120,130); // set cursor position to 120/130
Control.defineViewport(2, 1, 65, 70); // define viewport 2 with size of 65x70
Control.setCursorPosition(280,130); // set cursor position to 280/130
Control.defineViewport(3, 3, 78, 72); // define viewport 3 with size of 78x72
Control.selectViewport(1); // select viewport 1
Attribute.setBackgroundColor(0xFF0000); // set background color to red
Draw.eraseDisplay(); // fill viewport with background color
Draw.writeText("Viewport 1: Orientation = 0\0");
Control.selectViewport(2); // select viewport 2
Attribute.setBackgroundColor(0x00FF00); // set background color to green
Draw.eraseDisplay(); // fill viewport with background color
Draw.writeText("Viewport 2: Orientation = 1\0");
/* Cursor Position now relative to viewport Origin and Orientation: */
Control.setRelativeCursorPosition(11, 40);
Graphic.displayLocalGraphic(2);
Control.selectViewport(3); // select viewport 3
Attribute.setBackgroundColor(0x0000FF); // set background color to blue
Attribute.setForegroundColor(0xFFFFFF); // set foreground color to white
Draw.eraseDisplay(); // fill viewport with background color
Draw.writeText("Viewport 3\r"
+ "Orientation = 3\r"
+ "Scralling Text\r"
+ "---------------\r"
+ "Viewport 3:\r"
+ "Orientation = 3\r"
+ "Scrolling Text");
Not supported by: DPC3020, DPC2060, DPC10xx
Find following methods in this chapter as well as in the category "LCD Control..." when using the parameter completion feature of iLCD Manager XEJoC Manager:
Copyright © demmel products gmbh. All rights reserved.