Rating
TsgcHTMLComponent_Rating — Delphi, C++ Builder 및 .NET에서 선택적 숨김 폼 필드와 함께 별점(기호) 평가 표시 또는 입력을 렌더링합니다.
TsgcHTMLComponent_Rating — Delphi, C++ Builder 및 .NET에서 선택적 숨김 폼 필드와 함께 별점(기호) 평가 표시 또는 입력을 렌더링합니다.
취향에 맞게 크기와 색상이 지정된 채워진 기호와 빈 기호의 행, 그리고 값을 담는 선택적 숨김 입력을 내보내는 평가 컴포넌트입니다. 값과 최댓값을 설정한 다음, HTML 속성을 읽습니다.
Value와 MaxValue를 설정하고, 색상과 기호를 선택한 다음, HTML을 읽습니다 — 또는 한 줄짜리 정적 Build 헬퍼를 호출하십시오.
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");
가장 자주 사용하게 되는 멤버.
Value는 MaxValue(기본값 5) 중 채워지는 기호 수를 설정합니다. ShowValue는 value/max 캡션을 추가합니다.
ReadOnly(기본값 True)는 평가를 정적 표시로 렌더링합니다. 인터랙티브 입력을 원하면 False로 설정하십시오.
Color는 채워진 기호 색상을 CSS 문자열로 설정합니다. Color가 비어 있을 때 ColorStyle(TsgcHTMLColor, 예: hcWarning)이 Bootstrap 색상을 선택합니다.
FilledSymbol과 EmptySymbol은 글리프를 재정의합니다(기본 별 ★). Size는 글꼴 크기를 설정합니다.
InputName을 설정하면 숫자 값을 담는 숨김 <input>이 출력되어 평가가 폼과 함께 전송됩니다.
Build(value, maxValue, color)는 한 줄로 마크업을 반환합니다. HTML은 기호 행과 선택적 숨김 입력을 반환합니다.