User Tools

Site Tools


popup_commands

Popup Commands

CalendarSet provides four popups to assist in implementing an intuitive user interface built around the calendar object.


Using the Color Selection Popup

A color selection popup is available to aid the development of an interface for selecting color of calendar data, using the CalendarSet Color table.

The color popup includes the CM_SetColor command for setting the current color, and the CM_GetColor command to get the user selected color.


Using the Icon Selection Popup

An icon selection popup is included to display pictures from the 4D library in a palette. This provides an elegant interface tool for allowing user selection of icon data for a calendar.

The icon popup includes the IM_SetArray command for specifying what icons to include in the popup and the size of the icons, the IM_SetSelect command for setting the current popup item, and the IM_GetSelect command for getting the user selected item.


Using the Date and Time Selection Popups

Date and time selection popups are provided to enhance the user interface of entry and modification of date and time values. With both popups, two commands are available to set the current value, as well as to get the value selected by the user.

The date popup command to set the current value is MM_SetDate, and the command to get the value selected by the user is MM_GetDate. Two designs are available: one is MacOS oriented (legacy style), the other more of a Windows type (see Alternate “Windows” date popup), but you can use any option on both platforms.

The time popup command to set the current value is TM_SetTime, and the command to get the value selected by the user is TM_GetTime.

Note : both date and time popups will close on Escape or Cmd / Ctrl-dot (cancel), Enter, Shift-Enter, Return, Shift-Return, Tab or Shift-Tab (accept), Del (clear) keys.

See also MM_SetOptions and TM_SetOptions regarding click options to validate the popups.


Commands


%CM_PopArea

%CM_PopArea is a plugin area which allows you to implement a color palette popup on a 4D form. This popup allows the user to select a color from the Color table.


Area_SetEnable

(AreaRef; Enabled)

Parameter Type Description
→ AreaRef longint area reference of the popup area object on form
→ Enabled integer disable (0) or enable (1) the popup object

Area_SetEnable allows you to procedurally enable/disable any of the four (colors, icons, dates, times) popup type objects available in the CalendarSet plugin.

Note: this command does not affect a regular CalendarSet area.

Enabled — Integer. Use this parameter to specify whether you wish to disable (0) or enable (1) the popup.

Once disabled, the popup is not displayed when its icon is clicked. There is no need to call Area_Refresh after Area_SetEnable.

Examples

// disable the date popup eInvDate 
Area_SetEnable (eInvDate;0) 
// enable the color popup eColor 
Area_SetEnable (eColor;1) 

CM_GetColor

(AreaRef; ColorToGet)


Parameter Type Description
→ AreaRef longint area reference of the popup area object on form
← ColorToGet integer currently selected color in the popup object

CM_GetColor allows you to retrieve the color that the user selected the last time the color popup was used.

ColorToGet — Integer. Use this parameter to identify what color the user selected. Refer to the Color table for possible values.

Example

// get the currently selected color in the eColor popup 
CM_GetColor(eColor;vColor) 
[Calendar]Color:=vColor 

CM_SetColor

(AreaRef; ColorToSet)

Parameter Type Description
→ AreaRef longint area reference of the popup area object on form
→ ColorToSet integer desired color

CM_SetColor allows you to specify which color the popup should have selected when first popped up. The default color is black.

ColorToSet — Integer. This parameter is used to set the currently selected color for the popup. Refer to the Color table for possible values.

Example

// set the color for the eColor popup to the value in [Calendar]Color 
CM_SetColor(eColor;[Calendar]Color) 
// set the color for the eColor popup to Red 
CM_SetColor(eColor; CS_Color_Red) 

%IM_PopArea

%IM_PopArea allows you to implement an icon popup menu. 
 The icons that are displayed by the popup must be stored in the picture library.


IM_GetSelect

(AreaRef; CurrentSelectedItem)

Parameter Type Description
→ AreaRef longint area reference of the popup area object on form
← CurrentSelectedItem integer index number of the selected icon

IM_GetSelect allows you to retrieve the icon that the user selected the last time it was popped up. Use CurrentSelectedItem as an index into the icon array to determine the 4D picture library ID of the selected icon.

CurrentSelectedItem — Integer. This parameter returns an index into the icon array, indicating the icon selected by the user.

Example

// get the 4D picture library ID for the currently selected icon in the eIcon object 
IM_GetSelect(eIcon;vIndex)
[Calendar]Icon ID:=aIcons{vIndex} 

IM_SetArray

(AreaRef; ArrayName; IconSize; NumColumns)

Parameter Type Description
→ AreaRef longint area reference of the popup area object on form
→ IconArray text name of the array of picture library numbers for each icon
→ IconSize integer size to use for the icon
→ NumColumns integer number of columns of icons to display in the popup

IM_SetArray specifies the array to use when displaying the popup of icons.


IconArray — Text (name of an integer array). This array contains the 4D picture library IDs of the icons to display. The icons specified in IconArray must be stored in the picture library.


IconSize — Integer. This parameter is the size of the icon to use. The following values are allowed:

Mode Value Constant
Small Icons (16 x 16) 16 CS_Icon_Small
Large Icons (32 x 32) 32 CS_Icon_Large

NumColumns — Integer. Specifies the number of columns to display when the popup is displayed. If NumColumns is 0 the popup will have an equal number of rows and columns.

Example

// display the icons specified by the icon IDs in the array aIcons
  
// the icon object is eIcon, and the icons should be displayed as large icons 
// the icon popup should have an equal number of rows and columns 
IM_SetArray(eIcon;"aIcons";CS_Icon_Large;0) 

IM_SetSelect

(AreaRef; CurrentSelectedItem)

Parameter Type Description
→ AreaRef longint area reference of the popup area object on form
→ CurrentSelectedItem integer index into icon array

IM_SetSelect allows you to set the currently selected item in the popup.


CurrentSelectedItem — Integer. This parameter is used to set the currently selected icon in the popup. Default is 1.

Example

// set the icon popup eIcon to display the icon saved in [Calendar]Icon ID 
$ID_Index:=Find in array(aIcons;[Calendar]Icon ID)
  
If($ID_Index>0) // make sure the icon id is in the array 
 IM_SetSelect(eIcon;$ID_Index) 
End if 

%MM_PopArea

%MM_PopArea allows you to implement a calendar popup.


MM_GetDate

(AreaRef; DateToGet)

Parameter Type Description
→ AreaRef longint area reference of the popup area object on form
→ DateToGet date currently selected date in the calendar popup

MM_GetDate allows you to retrieve the date that the user selected the last time the MM popup was used.

DateToGet — Date. This parameter is the date selected by the user.

Example

// date popup object method 
If(Form event=On Clicked) 
 MM_GetDate(ePopDate;vDate) 
 [Invoice]Invoice Date:=vDate 
End if 

MM_SetDate

(AreaRef; DateToSet)


Parameter Type Description
→ AreaRef longint area reference of the popup area object on form
→ DateToSet date date the calendar popup should display when clicked

MM_SetDate allows you to specify which date the popup should have selected when first clicked (popped up).

DateToSet — Date. This parameter is used to specify the current selected date when the popup is clicked.

Example

// date popup object method ("only if modified" checkbox is turned off) 
If(Form event=On Load) 
 If(Record number([Invoice])=New record) // is this a new record? 
  MM_SetDate(ePopDate;Current date)
    [Invoice]Invoice Date:=Current date 
 Else 
  MM_SetDate(ePopDate;[Invoice]Invoice Date) 
 End if 
End if 

MM_SetOptions

(AreaRef; popIndicator; useDoubleClick; design; colors)

Parameter Type Description
→ AreaRef longint area reference of the popup area object on form
→ popIndicator integer popup indicator: arrows (0), none (1), calendar picture (2)
→ useDoubleClick integer close on single click (0) or double click (1)
→ design integer MacOS style (0) or Windows style (1)
→ colors text calendar colors

MM_SetOptions is used to configure the calendar popup object specified by AreaRef.

popIndicator — Integer, 0 to 2. This parameter lets you set the symbol which is displayed when the popup is not be clicked. You may desire a different appearance of the pop-up, such as placing a picture or icon below the plugin object. Possible values are:

Symbol Value Constant
Popup arrow(s) 0 CS_MM_PopArrows
None (transparent) 1 CS_MM_PopNone
Calendar picture (default) 2 CS_MM_PopPicture

useDoubleClick — Integer, 0 or 1. If this parameter is set to 0 (default) the popup will close on single click. Set it to 1 if you want it to close on double click.

design — Integer, 0 or 1. This parameter defines the look of the popup calendar. Both designs are available on both platforms:

colors — Text. 8 ARGB colors separated with “|” to be used by the popup.

  • First 5 colors define object backgrounds: active month, inactive month, selected date, current date, current selected date 

  • Next 2 colors define foreground: numbers in active month, numbers in inactive month 

  • 8th value is the popup background color; it needs a non-zero alpha channel to be set, e.g. #FFE9F1FF instead of #E9F1FF 


Default values are:

  • “#00FFFFDD|#00EEEEEE|#00EEAAAA| #00FF8888|#00FF5555|#00000000| #00444444|#00CCCCCC” for the MacOS (default) calendar look, and:

  • “#FFFFFFFE|#FFFFFFFE|#00EEEEEE| #00FF8888|#008F8F8F|#00000000| #00444444|#FFFFFFFC” for the Windows type popup (according to design).

Examples

// hide the indicator 
MM_SetOptions(eDatePop;CS_MM_PopNone) 
// display calendar picture as indicator 
MM_SetOptions(eDatePop;CS_MM_PopPicture) 

%TM_PopArea

%TM_PopArea allows you to implement a Time popup menu. This popup allows the user to select a time in 5 minute increments.

Note: the variables that are passed to TM_SetTime and TM_GetTime are not time variables, but rather text variables that are the names of the time variables.


TM_GetTime

(AreaRef;TimeToGet)

Parameter Type Description
→ AreaRef longint area reference of the popup area object on form
← TimeToGet text time selected last time popup clicked (variable name)

TM_GetTime allows you to retrieve the time that the user selected the last time the popup was clicked.

TimeToGet — Text. This parameter is the name of a time variable, which contains the time selected by the user.

Example

// get the time selected in the eCallTime popup 
TM_GetTime (eCallTime;"vCallTime")

[Call History]Call Time:=vCallTime 

TM_SetOptions

(AreaRef; popIndicator; useDoubleClick)

Parameter Type Description
→ AreaRef longint area reference of the %TM_PopArea object on form
→ popIndicator integer popup indicator: arrows (0), none (1), time picture (2)
→ useDoubleClick integer close on single click (0) or double click (1)

TM_SetOptions is used to configure the calendar popup object specified by AreaRef.

popIndicator — Integer, 0 to 2. This parameter lets you set the symbol which is displayed when the popup is not be clicked. You may desire a different appearance of the pop-up, such as placing a picture or icon below the plugin object. Possible values are:

Symbol Value Constant
Popup arrow(s) 0 CS_MM_PopArrows
None (transparent) 1 CS_MM_PopNone
Time picture (default) 2 CS_MM_PopPicture

useDoubleClick — Integer, 0 or 1. If this parameter is set to 0 (default) the popup will close on single click on minutes. Set it to 1 if you want it to close on double click on minutes.

Note: in both cases the popup will close on double click on hours.

Examples

// hide the indicator 
TM_SetOptions(eTimePop;CS_TM_PopNone) 
// display calendar picture as indicator 
TM_SetOptions(eTimePop;CS_TM_PopPicture) 

TM_SetTime

(AreaRef;TimeToSet)

Parameter Type Description
→ AreaRef longint area reference of the %TM_PopArea object on form
→ TimeToSet text time to preselect when popup clicked (variable name)

TM_SetTime allows you to specify the time the popup should have selected when first popped up. The time will default to the current time if this command is not issued.

TimeToSet — Text. This parameter is the name of a time variable to use to set the current time of the popup.

Example

// initialize the popup eCallTime to the value in the Call Time field 
If([Call History]Call Time#?00:00:00?) // if not a new record 
vTime:=[Call History]Call Time 
Else 
vTime:=Current time 
End if 
TM_SetTime(eCallTime;"vTime") 
popup_commands.txt · Last modified: 2017/07/14 14:49 by cs_admin