Why not supporting percentage for size and position for your components !!??
i think it is not difficult (just adding new property for unit px/%)
best regards
Why not supporting percentage for size and position for your components !!??
i think it is not difficult (just adding new property for unit px/%)
unit MWDBComboBox;
interface
uses
//IWCGLicenseKey,
Windows, SysUtils, Classes, IWBaseControl, IWCGDsnPaint, gFarahFuncs,
//IWDsnPaint, IWCGDsnPaint, IWCGDsnPaintHandlers,
IWCGJQControl, IWCGJQCommon, IWRenderContext, IWBaseHTMLControl, UITypes,
IWHTMLTag, IWXMLTag, IWBaseRenderContext, IWApplication, IWCGJSSuperObject,
Marah_Funcs, DB, IWCGJQComboBox;
type
TMWDBComboBox = class(TIWCGJQComboBoxEx)
private
{ Private declarations }
fAccessType : TAccessType;
fVisibility : Boolean;
FEnability : Boolean;
fLookupDataSet : TDataSet;
fLookupKeyField: string;
fLookupListField : string;
fContainerStyle: TIWCGStyle;
function GetContainerStyle: TIWCGStyle;
procedure SetContainerStyle(const Value: TIWCGStyle);
procedure SetAccessType(Value : TAccessType);
procedure SetVisibility(Value: Boolean);
procedure SetEnability(Value: Boolean); virtual;
procedure SetLookupDataSet(Value: TDataSet);
protected
{ Protected declarations }
function RenderAsync(AContext: TIWCompContext): TIWXMLTag; override;
function RenderStyle(AComponentContext: TIWCompContext): string; override;
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function RenderHTML(AContext: TIWCompContext): TIWHTMLTag; override;
procedure FillItemsFromLookupDS;
published
{ Published declarations }
Property AccessType : TAccessType read fAccessType write SetAccessType Default atEdit;
property Visibility : Boolean read fVisibility write SetVisibility default True;
property Enability : Boolean read fEnability write SetEnability default True;
property LookupDataSet : TDataSet read fLookupDataSet write SetLookupDataSet;
property LookupKeyField : string read fLookupKeyField write fLookupKeyField;
property LookupListField : string read fLookupListField write fLookupListField;
property ContainerStyle: TIWCGStyle read GetContainerStyle write SetContainerStyle;
end;
procedure Register;
implementation
constructor TMWDBComboBox.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
fAccessType := atEdit;
fVisibility := True;
fEnability := True;
//FillItemsFromLookupDS;
end;
destructor TMWDBComboBox.Destroy;
begin
FreeAndNil(FContainerStyle);
inherited;
end;
function TMWDBComboBox.GetContainerStyle: TIWCGStyle;
begin
if not Assigned(FContainerStyle) then
FContainerStyle:= TIWCGStyle.Create;
Result:= FContainerStyle;
end;
procedure TMWDBComboBox.SetContainerStyle(const Value: TIWCGStyle);
begin
ContainerStyle.Assign(Value);
end;
function TMWDBComboBox.RenderStyle(AComponentContext: TIWCompContext): string;
var
SL: TIWCGStyle;
begin
Result:= inherited RenderStyle(AComponentContext);
SL:= TIWCGStyle.Create;
try
SL.IWStyle:= Result + CGInsertSemiColon(ContainerStyle.RawStyle);
Result:= SL.RawStyle;
finally
SL.Free;
end;
end;
function TMWDBComboBox.RenderAsync(AContext: TIWCompContext): TIWXMLTag;
begin
Result:= inherited RenderAsync(AContext);
end;
function TMWDBComboBox.RenderHTML(AContext: TIWCompContext): TIWHTMLTag;
begin
FillItemsFromLookupDS;
Result:= inherited RenderHTML(AContext);
end;
procedure TMWDBComboBox.FillItemsFromLookupDS;
begin
FillComboBoxFromItemsFromDS(Self);
end;
procedure TMWDBComboBox.SetAccessType(Value : TAccessType);
begin
if fAccessType <> Value then begin
fAccessType := Value;
Visible := fVisibility And (fAccessType <> atNone);
Enabled := fEnability And (fAccessType = atEdit);
end;
end;
procedure TMWDBComboBox.SetVisibility(Value: Boolean);
begin
if fVisibility <> Value then begin
fVisibility := Value;
Visible := fVisibility And (fAccessType <> atNone);
end;
end;
procedure TMWDBComboBox.SetEnability(Value: Boolean);
begin
if fEnability <> Value then begin
fEnability := Value;
Enabled := fEnability And (fAccessType = atEdit);
end;
end;
procedure TMWDBComboBox.SetLookupDataSet(Value: TDataSet);
begin
if fLookupDataSet <> Value then begin
fLookupDataSet := Value;
FillItemsFromLookupDS;
end;
end;
procedure Register;
begin
RegisterComponents('Marah Almosa', [TMWDBComboBox]);
IWRegisterPaintHandler('TMWDBComboBox',TIWCGJQPaintHandlerDsn);
end;
end.