Rating
TsgcHTMLComponent_Rating — genera una valoración por estrellas (símbolos) como pantalla o como input, con un campo de formulario oculto opcional, en Delphi, C++ Builder y .NET.
TsgcHTMLComponent_Rating — genera una valoración por estrellas (símbolos) como pantalla o como input, con un campo de formulario oculto opcional, en Delphi, C++ Builder y .NET.
Un componente de valoración que genera una fila de símbolos llenos y vacíos con el tamaño y el color que prefieras, además de un input oculto opcional que lleva el valor. Define el valor y el máximo, y luego lee la propiedad HTML.
TsgcHTMLComponent_Rating
Valoración por símbolos + input oculto de formulario
Delphi, C++ Builder, .NET
Define Value y MaxValue, elige un color y los símbolos, y luego lee HTML — o llama al método estático Build para hacerlo en una sola línea.
uses
sgcHTML_Component_Rating;
var
oRating: TsgcHTMLComponent_Rating;
begin
oRating := TsgcHTMLComponent_Rating.Create(nil);
try
oRating.Value := 4;
oRating.MaxValue := 5;
oRating.Color := '#ffc107';
oRating.ShowValue := True;
oRating.InputName := 'score';
oRating.ReadOnly := False;
WebModule.Response := oRating.HTML; // stars + hidden input
finally
oRating.Free;
end;
end;
// Or the static one-liner (value, maxValue, color):
Result := TsgcHTMLComponent_Rating.Build(4, 5, '#ffc107');
// includes: sgcHTML_Component_Rating.hpp
TsgcHTMLComponent_Rating *oRating = new TsgcHTMLComponent_Rating(NULL);
try
{
oRating->Value = 4;
oRating->MaxValue = 5;
oRating->Color = "#ffc107";
oRating->ShowValue = true;
oRating->InputName = "score";
oRating->ReadOnly = false;
String html = oRating->HTML; // stars + hidden input
}
__finally
{
delete oRating;
}
// Or the static one-liner:
String html = TsgcHTMLComponent_Rating::Build(4, 5, "#ffc107");
using esegece.sgcWebSockets;
var rating = new TsgcHTMLComponent_Rating();
rating.Value = 4;
rating.MaxValue = 5;
rating.Color = "#ffc107";
rating.ShowValue = true;
rating.InputName = "score";
rating.ReadOnly = false;
string html = rating.HTML; // stars + hidden input
// Or the static one-liner:
string html2 = TsgcHTMLComponent_Rating.Build(4, 5, "#ffc107");
Los miembros que más utilizarás.
Value define cuántos símbolos se rellenan de un total de MaxValue (5 por defecto); ShowValue añade una leyenda value/max.
ReadOnly (True por defecto) genera la valoración como una pantalla estática; defínelo en False para un input interactivo.
Color define el color de los símbolos llenos como una cadena CSS; ColorStyle (TsgcHTMLColor, p. ej. hcWarning) elige un color de Bootstrap cuando Color está vacío.
FilledSymbol y EmptySymbol sustituyen los glifos (estrella por defecto ★); Size define el tamaño de la fuente.
Define InputName para generar un <input> oculto que lleva el valor numérico, de modo que la valoración se envía de vuelta con el formulario.
Build(value, maxValue, color) devuelve el marcado en una línea; HTML devuelve la fila de símbolos más el input oculto opcional.
| Todos los componentes de sgcHTMLExplora la matriz de características completa de más de 60 componentes. | Abrir | |
| Descargar prueba gratuitaLa prueba de 30 días incluye los proyectos de demostración 60.HTML. | Abrir | |
| PreciosLicencias Single, Team y Site con todo el código fuente. | Abrir |