The Appeon resize object helps developers easily resize UI elements to fit with multiple screens, especially for the mobile apps.
The eon_appeon_resize object provides the most capacity and flexibility because it can not only resize the window and the user object container, but also the controls and the font, at the same time, it also allows you to dynamically change the resize behavior for a particular window/user object/control at runtime.
- of_fontresize
- of_getscale (internal function)
- of_gettag
- of_init
- of_init_object
- of_internal_resize (internal function)
- of_orginterval_h (internal function)
- of_orginterval_w (internal function)
- of_orginterval_x (internal function)
- of_orginterval_y (internal function)
- of_pause
- of_recover
- of_registered (internal function)
- of_resizable (internal function)
- of_resize
- of_setflag
- of_start
- of_stop
- of_stringtoarray (internal function)
- of_typeof (internal function)
- of_zoom
Description
Determines whether the font is resized proportionally with the control.
Syntax
of_fontresize
( boolean
ab_resize
, integer
ai_type
)
Parameter
ab_resize
- When true, the font is
automatically resized; when false, the font is not resized.
ai_type
- 1 - Resizes with the height;
2 - Resizes with the width; 3 - Resizes with the height or width
whichever has the smaller change in proportion; 4 - Resizes with the
height or width whichever has the bigger change in
proportion.
Return value
None
Description
This is an internal function that will be automatically called when resize script is executed.
Gets the default ratio of each control.
Syntax
of_getscale
( string
as_input
, ref string
as_flag
, ref string
as_xscale
, ref string
as_yscale
, ref string
as_wscale
, ref string
as_hscale
)
of_getscale
( string
as_input
, ref string
as_flag
, ref string
as_xscale
, ref string
as_yscale
, ref string
as_wscale
, ref string
as_hscale
, ref string
as_width
, ref string
as_height
)
of_getscale
( string
as_input
, ref string
as_flag
, ref string
as_xscale
, ref string
as_yscale
, ref string
as_wscale
, ref string
as_hscale
, ref string
as_width
, ref string
as_height
, ref string
as_fontsize
)
Return value
None
Description
Gets the original tag of a control or object. Original tag includes the information that is not altered by the of_init function.
Syntax
of_gettag
( windowobject
awo
)
Parameter
awo
- The name of the object or
control.
Return value
String. The original tag information of the control or object.
Description
Initializes the user object container or the window that needs
to be resized. You can initialize the user object container or the
window only; you can also initialize the controls contained in the
user object container or the window by setting the
ab_recursion
parameter to true. Only the
initialized user object/window/control can be resized, therefore,
this function must be the very first one to be called.
By initializing the user object/window/control, it actually registers the following information to the Tag property of the user object/window/control, separated by "/":
register flag
/resize
flag
/flag
/x
ratio
/y ratio
/width
ratio
/height
ratio
/width
/height
/x
/y
/parentwidth
/parentheight
/{textsize
}/original
tag
flag
: used by the developer to manually
specify the resize behavior of a control or object, such as
scaletobottom, fixtoright etc. By default, the value is "1111". It
can be set by using the of_setflag
function.
textsize
: only effective when the
control or object has the textsize property.
Syntax 1: Initializes the user object.
If ab_recursion
is true, all of the controls
contained in the user object will be initialized as
well.
of_init
( userobject
au_uo
, boolean
ab_recursion
)
Syntax 2: Initializes the user object.
If ab_recursion
is true, all of the controls
contained in the user object will be initialized as
well.
of_init
( userobject
au_uo
, integer
ai_width
, integer
ai_height
, boolean
ab_recursion
)
Syntax 3: Initializes the window and the
controls in it. If ab_recursion
is true, all
of the user objects and tab controls contained in the window will be
initialized as well.
of_init
( window
aw_window
, boolean
ab_recursion
)
Parameter
au_uo
- The name of the user object
container to be initialized.
aw_window
- The name of the window
container to be initialized, and the controls in the window will be
automatically initialized as well.
ai_width
- The new width of the user
object container. The original proportion of each control will be
calculated based on it.
ai_height
- The new height of the user
object container. The original proportion of each control will be
calculated based on it.
ab_recursion
- When true, the controls
contained in the user object container will be initialized as well;
or the user objects and tab controls in the window container will be
initialized as well; when false, only the user object container or
the window (and controls in the window) will be initialized.
Return value
None
Description
Changes the ratio of a single object or control that has been registered using of_init.
Syntax
of_init_object
( windowobject
awo
, decimal
ad_xscale
, decimal
ad_yscale
, decimal
ad_wscale
, decimal
ad_hscale
)
of_init_object
( windowobject
awo
, integer
ai_parentwidth
, integer
ai_parentheight
, boolean
ab_recursion
)
of_init_object
( windowobject
awo
, boolean
ab_recursion
)
Comparatively speaking, the second syntax is easier to use and produce the desired layout; the first syntax would require more testing to determine an accurate x/y ratio.
The third syntax is for refreshing the object or control easily without needing a lot arguments.
Parameter
awo
- The name of the object or control
to be initialized.
ad_xscale
- The new x ratio.
ad_yscale
- The new y ratio.
ad_wscale
- The new width ratio.
ad_hscale
- The new height
ratio.
ai_parentwidth
- The new width of the
parent container.
ai_parentheight
- The new height of the
parent container.
ab_recursion
- When true, the controls
contained in the object or the control will be initialized as well;
when false, only the object or the control will be
initialized.
Return value
None
Description
This is an internal function that will be automatically called when resize script is executed.
Resizes the DragObject by utilizing its flag.
Syntax
of_internal_resize
( ref dragobject
awo
, string as_flag
,
integer ai_newwidth
, integer
ai_newheight
, string
as_xbl
, string as_ybl
,
string as_wbl
, string
as_hbl
)
Parameter
awo
- The name of the
DragObject.
as_flag
- The flag of the
DragObject.
ai_newwidth
- The new width of the
DragObject.
ai_newheight
- The new height of the
DragObject.
as_xbl
- The x ratio of the
DragObject.
as_ybl
- The y ratio of the
DragObject.
as_wbl
- The width ratio of the
DragObject.
as_hbl
- The height ratio of the
DragObject.
Return value
None.
Description
This is an internal function that will be automatically called when resize script is executed.
Gets the default height of a control.
Syntax
of_orginterval_h
( windowobject
awo
)
Parameter
awo
- The name of the object or
control.
Return value
Long. The default height of the control.
Description
This is an internal function that will be automatically called when resize script is executed.
Gets the default width of a control.
Syntax
of_orginterval_w
( windowobject
awo
)
Parameter
awo
- The name of the object or
control.
Return value
Long. The default width of the control.
Description
This is an internal function that will be automatically called when resize script is executed.
Gets the default x coordinate of a control.
Syntax
of_orginterval_x
( windowobject
awo
)
Parameter
awo
- The name of the object or
control.
Return value
Long. The default x coordinate of the control.
Description
This is an internal function that will be automatically called when resize script is executed.
Gets the default y coordinate of a control.
Syntax
of_orginterval_y
( windowobject
awo
)
Parameter
awo
- The name of the object or
control.
Return value
Long. The default y coordinate of the control.
Description
Pauses the auto-resizing service for all controls. It is used in pair with of_recover.
Syntax
of_pause
( )
Return value
None.
Description
Resumes the auto-resizing service for all controls. It is used in pair with of_pause.
Syntax
of_recover
( )
Return value
None.
Description
This is an internal function that will be automatically called when resize script is executed.
Checks whether a control has been registered/initialized.
Syntax
of_registered
( windowobject
awo
)
Parameter
awo
- The name of the object or
control.
Return value
Boolean.
Description
This is an internal function that will be automatically called when resize script is executed.
Checks whether a control is resizable.
Syntax
of_resizable
( windowobject
awo
)
Parameter
awo
- The name of the object or
control.
Return value
Boolean.
Description
Resizes a control according to the registered information.
Syntax 1: Resizes the user object.
of_resize
( userobject
au_uo
, integer
ai_newwidth
, integer
ai_newheight
, boolean
ab_recursion
)
Syntax 2: Resizes the window and the
controls in the window. If ab_recursion
is
true, objects in the user object and tab controls will be resized as
well.
of_resize
( window
aw_window
, integer
ai_newwidth
, integer
ai_newheight
, boolean
ab_recursion
)
Syntax 3: Resizes the DataWindow control. Normally the DataWindow control will be resized with its parent container, therefore, it is not recommended to call this function to resize it.
of_resize
( datawindow
adw
, integer
ai_newwidth
, integer
ai_newheight
, boolean
ab_zoom
, integer
ai_type
, decimal
ad_maxrate
)
Syntax 4: Resizes the DataWindow control. Normally the DataWindow control will be resized with its parent container, therefore, it is not recommended to call this function to resize it.
of_resize
( datawindow
adw
, integer
ai_newwidth
, integer
ai_newheight
, decimal
ad_maxrate
)
Parameter
au_uo
- The name of the user object
container to be resized.
aw_window
- The name of the window to
be resized.
adw
- The name of the DataWindow to be
resized.
ai_newwidth
- The new width of the user
object container, the window, or the DataWindow.
ai_newheight
- The new height of the
user object container, the window, or the DataWindow.
ab_zoom
- Sets whether the DataWindow
control is resizable.
ai_type
- The type of resizing. See
of_zoom for more.
ad_maxrate
- The maximum resize
ratio.
ab_recursion
- When true, the controls
contained in the user object container or the window will be resized
as well; when false, only the user object container or the window
will be resized.
Return value
None.
Description
Sets the flag of a control or object, so that the control or object will be resized differently.
Syntax
of_setflag
( windowobject
awo
, string as_flag
)
Parameter
awo
- The name of the object or
control.
as_flag
- The flag of the object or
control. The value of flag is composed of 4 digits, by default it is
"1111".
The first digit indicates the resize behavior of the x coordinate: 0 - Keeps unchanged; 1 - Changes proportionally; 2 - Moves to right horizontally.
The second digit indicates the resize behavior of the y coordinate: 0 - Keeps unchanged; 1 - Changes proportionally; 2 - Moves down vertically.
The third digit indicates the resize behavior of the width: 0 - Keeps unchanged; 1 - Changes proportionally; 2 - Extends to right horizontally; 3 - Extends to left horizontally; 4 - Extends to right edge; 5 - Extends to left edge.
The fourth digit indicates the resize behavior of the height: 0 - Keeps unchanged; 1 - Changes proportionally; 2 - Extends down vertically; 3 - Extends up vertically; 4 - Extends to the bottom; 5 - Extends to the top.
Return value
Boolean.
Description
Restarts the auto-resizing service for a control or object. It is used in pair with of_stop.
Syntax
of_start
( windowobject
awo
)
Parameter
awo
- The name of the object or
control.
Return value
None.
Description
Stops the auto-resizing service for a control or object. It is used in pair with of_start.
Syntax
of_stop
( windowobject
awo
)
Parameter
awo
- The name of the object or
control.
Return value
None.
Description
This is an internal function that will be automatically called when resize script is executed.
Splits a string into an array.
Syntax
of_stringtoarray
( string
as_input
, ref string
as_array[]
, string
as_flag
)
Return value
None.
Description
This is an internal function that will be automatically called when resize script is executed.
Checks the type of a control or an object.
Syntax
of_typeof
( windowobject
awo_control
)
Return value
String. The type of the control or the object.
Description
Determines whether to turn on or off the resizing feature for the DataWindow control.
Syntax
of_zoom
( boolean
ab_zoom
, integer
ai_type
)
of_zoom
( boolean
ab_zoom
, integer
ai_type
, decimal
adec_rate
)
Parameter
ab_zoom
- When true, resizing feature
for the DataWindow control is enabled; when false, resizing feature
is disabled.
ai_type
- 1 - Resizes proportionally
with height; 2 - Resizes proportionally with width; 3 - Resizes with
height or width whichever has the smaller change in proportion; 4:
Resizes with height or width whichever has the bigger change in
proportion.
adec_rate
- The maximum resizing rate
of the DataWindow control. By default, it is 3, which means the
DataWindow control can be resized by no more than 300%.
Return value
None.
Below is the sample code for resizing a user object. The code for resizing a window is similar.
//declears the instance variable for the user object eon_appeon_resize ieon_resize //initializes in the constructor event of the user object //(if it is window, initializes in the open event of the window) ieon_resize = create eon_appeon_resize // registers all of the controls contained in this user object ieon_resize.of_init( this, true) //enables font resizing and resizes with the width ieon_resize.of_fontresize( true, 2) //enables datawindow resizing and resizes with the width ieon_resize.of_zoom( true, 2) //changes the datawindow resize behavior by keeping x and y coordinates unchanged, //and scaling to the right edge and to the bottom of the user object container. ieon_resize.of_setflag( dw_1, '0044') //keeps the cb_1 size unchanged, and also keeps its relative position unchanged //which means the distances from the right edge and from the bottom remain the same. ieon_resize.of_setflag( cb_1, '2222') //defines the resize event for the user object, event ID is set to pbm_size //Resizes all of the controls contained in the user object ieon_resize.of_resize( this, newwidth, newheight, true) //destroys the user object in the destructor event Destroy ieon_resize