Player APIs (BrightScript & Ja...
...
Object Reference
Presentation and Widget Object...
roClockWidget
13min
this object places a clock on the screen it has construction arguments only object creation the roclockwidget object is created with several parameters createobject("roclockwidget", rect as rorectangle, res as roresourcemanager, display type as integer) rect the rectangle in which the clock is displayed the widget picks a font based on the size of the rectangle res a resources txt file that allows localization via the roresourcemanager object (see below for further details) display type use 0 for date only, and 1 for clock only to show both on the screen, you need to create two widgets example rect=createobject("rorectangle", 0, 0, 300, 60) res=createobject("roresourcemanager", "resources txt") c=createobject("roclockwidget", rect, res, 1) c show() the resource manager is passed into the widget, which uses the following resources within the resources txt file to display the time and date correctly here are the "eng" entries \[clock date format] eng "%a, %b %e, %y" \[clock time format] eng "%l %m" \[clock time am] eng "am" \[clock time pm] eng "pm" \[clock date short month] eng "jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec" \[clock date long month] eng "january|february|march|april|may|june|july|august|september|october|november|december" \[clock date short day] eng "sun|mon|tue|wed|thu|fri|sat" \[clock date long day] eng "sunday|monday|tuesday|wednesday|thursday|friday|saturday" control characters the following are the control characters for the date/time format strings // date format // // %a abbreviated weekday name // %a long weekday name // %b abbreviated month name // %b full month name // %d day of the month as decimal 01 to 31 // %e like %d, the day of the month as a decimal number, but without leading zero // %m month name as a decimal 01 to 12 // %n like %m, the month as a decimal number, but without leading zero // %y two digit year // %y four digit year // time format // // %h the hour using 24 hour clock (00 to 23) // %i the hour using 12 hour clock (01 to 12) // %k the hour using 24 hour clock (0 to 23); single digits are preceded by a blank // %l the hour using 12 hour clock (1 to 12); single digits are preceded by a blank // %m minutes (00 to 59) // %s seconds (00 to 59) ifwidget setforegroundcolor(color as integer) as boolean sets the foreground color in argb format hex color values should be converted to integers before being passed to this method (e g the value \&hffffffff should be passed as 4294967295) you can use the hextointeger() method (available in the core library extension docid\ leoo6do arr2igzxcripi ) to convert a hex string to an integer setbackgroundcolor(color as integer) as boolean sets the background color in argb format hex color values should be converted to integers before being passed to this method (e g the value \&hffffffff should be passed as 4294967295) you can use the hextointeger() method (available in the core library extension docid\ leoo6do arr2igzxcripi ) to convert a hex string to an integer the top 8 bits of the setforegroundcolor() and setbgackgroundcolor() values are "alpha" parameters zero is equivalent to fully transparent and 255 to fully non transparent this feature allows for effects similar to subtitles for example, you can create a semi transparent black box containing text over video setfont(font filename as string) as boolean sets the font filename using a truetype font (for example, sd /arial ttf ) setbackgroundbitmap(bitmap filename as string, stretch as boolean) as boolean sets the background bitmap image if stretch is true, then the image is stretched to the size of the window setbackgroundbitmap(parameters as roassociativearray, stretch as boolean) as boolean sets the background bitmap image if stretch is true, then the image is stretched to the size of the window the associative array can contain the following parameters filename the name of the image file encryptionalgorithm the file encryption algorithm currently the options are "aesctr" and "aesctrhmac" encryptionkey the key to decrypt the image file this is a byte array consisting of 128 bits of key, followed by 128 bits of iv see roimageplayer docid 0umxqyvruy7drnluuzafp for details on displaying encrypted images setsafetextregion(region as rorectangle) as boolean specifies the rectangle within the widget where the text can be drawn safely show() as boolean displays the widget after creation, the widget is hidden until show() is called hide() as boolean hides the widget raise() as void sends the widget to the top of the z order on the graphics plane (i e in front of all other surfaces that implement the ifwidget interface) by default, new widgets are placed at the top of the graphics z order some surfaces are always drawn at the top of the graphics z order, including the mouse cursor, closed captions, and rotextwidget docid\ gqenktmmfazejdlzhttiz tip you can use the pausegraphics() / resumegraphics() methods on the rovideomode docid\ qq734nqz0hcwni0unsdmp object to ensure multiple changes to the graphics z order occur simultaneously lower() as void sends the widget to the bottom of the z order on the graphics plane (i e behind all other surfaces that implement the ifwidget interface) by default, new widgets are placed at the top of the graphics z order getfailurereason() as string yields additional useful information if a function return indicates an error setrectangle(r as rorectangle) as boolean changes the size and positioning of the widget rectangle using the passed rorectangle object