mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-07 16:06:16 +02:00
* Implemented form-input buttons. Especially usefull since the button-tag in is implemented wrongly in IE
* Checkboxes are now checked is .asboolean is true, instead of some arbitrary string comparisions git-svn-id: trunk@8437 -
This commit is contained in:
parent
327c0834ac
commit
d304408a1b
@ -29,7 +29,7 @@ type
|
|||||||
TFieldCellEvent = procedure (Sender:THTMLDatasetFormProducer; FieldDef:TFormFieldItem;
|
TFieldCellEvent = procedure (Sender:THTMLDatasetFormProducer; FieldDef:TFormFieldItem;
|
||||||
IsLabel:boolean; Cell : THTMLCustomelement) of object;
|
IsLabel:boolean; Cell : THTMLCustomelement) of object;
|
||||||
TButtonEvent = procedure (Sender:THTMLDatasetFormProducer; ButtonDef:TFormButtonItem;
|
TButtonEvent = procedure (Sender:THTMLDatasetFormProducer; ButtonDef:TFormButtonItem;
|
||||||
Button : THTML_button) of object;
|
Button : THTMLAttrsElement) of object;
|
||||||
TProducerEvent = procedure (Sender:THTMLDatasetFormProducer; FieldDef:TFormFieldItem;
|
TProducerEvent = procedure (Sender:THTMLDatasetFormProducer; FieldDef:TFormFieldItem;
|
||||||
Producer:THTMLContentProducer) of object;
|
Producer:THTMLContentProducer) of object;
|
||||||
THTMLElementEvent = procedure (Sender:THTMLDatasetFormProducer; element : THTMLCustomElement) of object;
|
THTMLElementEvent = procedure (Sender:THTMLDatasetFormProducer; element : THTMLCustomElement) of object;
|
||||||
@ -115,7 +115,7 @@ type
|
|||||||
property Items [index : integer] : TFormFieldItem read GetItem write SetItem;
|
property Items [index : integer] : TFormFieldItem read GetItem write SetItem;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TFormButtonType = (fbtSubmit, fbtReset, fbtPushbutton);
|
TFormButtonType = (fbtSubmit, fbtReset, fbtPushbutton, fbtInputSubmit,fbtInputReset,fbtInputPushButton);
|
||||||
TImagePlace = (ipOnly, ipBefore, ipAfter, ipUnder, ipAbove);
|
TImagePlace = (ipOnly, ipBefore, ipAfter, ipUnder, ipAbove);
|
||||||
|
|
||||||
{ TFormButtonItem }
|
{ TFormButtonItem }
|
||||||
@ -559,10 +559,25 @@ end;
|
|||||||
procedure THTMLDatasetFormProducer.WriteButtons(aWriter: THTMLWriter);
|
procedure THTMLDatasetFormProducer.WriteButtons(aWriter: THTMLWriter);
|
||||||
|
|
||||||
procedure WriteButton (aButton : TFormButtonItem);
|
procedure WriteButton (aButton : TFormButtonItem);
|
||||||
const ButtonTypes : array[TFormButtontype] of THTMLbuttontype = (btsubmit,btreset,btbutton);
|
const ButtonTypes : array[TFormButtontype] of THTMLbuttontype = (btsubmit,btreset,btbutton,btreset,btreset,btreset);
|
||||||
|
const InputTypes : array[TFormButtontype] of THTMLinputtype = (itreset,itreset,itreset,itsubmit,itreset,itbutton);
|
||||||
var b : THTML_Button;
|
var b : THTML_Button;
|
||||||
|
ib: THTML_input;
|
||||||
begin
|
begin
|
||||||
with aWriter do
|
with aWriter do
|
||||||
|
if aButton.ButtonType in [fbtInputPushButton,fbtInputReset,fbtInputSubmit] then
|
||||||
|
begin
|
||||||
|
ib := input;
|
||||||
|
with ib do
|
||||||
|
begin
|
||||||
|
Name := aButton.name;
|
||||||
|
Value := aButton.value;
|
||||||
|
TheType := InputTypes[aButton.ButtonType];
|
||||||
|
if assigned (FAfterButtonCreate) then
|
||||||
|
FAfterButtonCreate (self, aButton, ib);
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else
|
||||||
begin
|
begin
|
||||||
b := Startbutton;
|
b := Startbutton;
|
||||||
with b do
|
with b do
|
||||||
@ -871,8 +886,7 @@ procedure THTMLDatasetFormEditProducer.ControlToTableDef (aControldef : TFormFie
|
|||||||
if aControlDef.inputType in [fitcheckbox,fitradio] then
|
if aControlDef.inputType in [fitcheckbox,fitradio] then
|
||||||
begin
|
begin
|
||||||
with aControlDef.Field do
|
with aControlDef.Field do
|
||||||
Checked := not isnull and (asstring <> '0') and (asstring <> '-')
|
Checked := asBoolean;
|
||||||
and (comparetext(asstring,'false') <> 0);
|
|
||||||
if assigned (FOnFieldChecked) then
|
if assigned (FOnFieldChecked) then
|
||||||
FOnFieldChecked (aControlDef.Field, check);
|
FOnFieldChecked (aControlDef.Field, check);
|
||||||
Checked := check;
|
Checked := check;
|
||||||
|
Loading…
Reference in New Issue
Block a user