AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Controles, páginas y ventanas / Funciones de cadenas gráficas
  • Where to use gStoredValue
  • Added value
  • Case sensitivity
  • Auto-filled combo boxes
  • Retrieved element
  • Scheduler control
  • Special case: Combo Box control or Combo in a Table control field
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
Adds an "invisible" value to an element in a List Box, Combo Box or Scheduler control. This value will be the stored value when the control element is selected by the user.
Remarks:
  • To get the stored value associated with an element of the control, use the StoredValue property.
  • To retrieve the value defined by gStoredValue:
    • use the gStoredValueEnable function.
    • WINDEVAndroidWidget Android Java check "Devolver el valor especificado con la función gStoredValue" ("Details" tab of the control description).
    In this case, the control will directly return the value of gStoredValue that corresponds to the selected option.
  • This function is equivalent to gLink.
Ejemplo
// Button control code to populate the Combo Box control
// ----------------------------------------------
// The "COMBO_Title" Combo Box displays personal titles:
// "Mister", "Madam" and "Miss".
// An integer representing a gender will be returned to the language
ListeAdd(COMBO_Title, "Mister" + gStoredValue("1"))
// Only the string "1" is returned to the language.
// This string is not displayed in the Combo Box control.
// Button control code to get the value of gStoredValue
// -------------------------------------------------------------------------------
// Code to get the value of gStoredValue for the selected option
Info(COMBO_Title[COMBO_Title].StoredValue)
// Displays "1" in our example.
Sintaxis
<Result> = gStoredValue(<String to return>)
<Result>: Character string
Control string that must be used in ListAdd, ListInsert or ListModify.
<String to return>: Character string
Text value to return. Only this string will be returned to the language. This string will not be displayed in the row.
Observaciones

Where to use gStoredValue

gStoredValue can be called anywhere in the row to be added.
For example:
ListAdd(COMBO_COMBO1, gStoredValue("1") + "Mister")
// or
ListAdd(COMBO_COMBO1, "Mister" + gStoredValue("1"))

Added value

Values added with gStoredValue are not taken into account for sort operations and keyboard shortcuts.
If multiple values are added to an element of a list box with gStoredValue, only the first value will be returned.
ListAdd(LIST_LIST1, "MyElement" + gStoredValue("Link1") + gStoredValue("Link2"))
In this example, only the "Link1" value will be returned.
ListSeek takes into account the values added by gStoredValue.

Case sensitivity

gStoredValue is case-insensitive.
Therefore, the following code:
ListAdd(LIST_LIST1, "MyElement" + gStoredValue("AAA"))
will be equivalent to:
ListAdd(LIST_LIST1, "MyElement" + gStoredValue("aaa"))

Auto-filled combo boxes

gStoredValue is used to manage "Auto-filled Combo Box" controls.

Retrieved element

When an element is retrieved from a List Box or Combo Box control, the priority order is as follows:
  1. Values added by gStoredValue.
  2. Values added by gToRetrieve.
To get the stored value associated with an element of the control, use the StoredValue property.

Scheduler control

If the resources in the schedule have been created with SchedulerAddResource using gStoredValue, the name of the resource obtained with the SelectedResource property will correspond to the value specified in the gStoredValue function for this resource.
Example:
// Adds a resource (a meeting room) into the Scheduler control
// Meeting is the data file that describes the available meeting rooms
SchedulerAddResource(SCH_RoomOccupancy, Meeting.Name + gStoredValue(Meeting.MeetingID))
 
...
 
// Click code on BTN_NEW_APT button
MyAPT is Appointment
IF SCH_RoomOccupancy.SelectedResource = "" THEN
       RETURN
END
 
MyAPT.StartDate = SCH_RoomOccupancy.StartDate
MyAPT.EndDate = SCH_RoomOccupancy.EndDate
MyAPT.Resource = SCH_RoomOccupancy.SelectedResource
// The name of the resource corresponds to the value specified
// in gStoredValue for this resource

Special case: Combo Box control or Combo in a Table control field

If gStoredValue must return an empty string (""), the result will be different if the control used is a Combo Box control or a Combo Box column in a Table control.
The following code is used:
ListAdd(COMBO, "MyElement" + gStoredValue(""))
the value retrieved will be:
  1. an empty string ("") in the case of a Combo Box control,
  2. 0 (zero) in the case of a Combo Box column in a Table control.
To use the same code to retrieve the value of gStoredValue for a Combo Box control and a Combo Box column, it is recommended to use a Combo Box control in a container column in the Table control.
Componente: wd300obj.dll
Versión mínima requerida
  • Versión 27
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 27/03/2025

Señalar un error o enviar una sugerencia | Ayuda local