Jump to content

FieldLabel


picyka

Recommended Posts

Hi, I can do a type cast on one to improve this code

 

class procedure TConfigureRequired.Configure(List: TDictionary<String, TComponent>; Dataset: TAureLiusDataSet);
begin
  for var lControle in List do
  begin
    if Dataset.FieldByName(lControle.Key).Required then
    begin
      if lControle.Value is TUniDBEdit then
        TUniDBEdit(lControle.Value).FieldLabel := TUniDBEdit(lControle.Value).FieldLabel + '<font color="Red"> *</font>'
      else
      if lControle.Value is TUniDBComboBoxObject then
        TUniDBComboBoxObject(lControle.Value).FieldLabel := TUniDBComboBoxObject(lControle.Value).FieldLabel + '<font color="Red"> *</font>'
      else
      if lControle.Value is TUniDBDateTimePicker then
        TUniDBDateTimePicker(lControle.Value).FieldLabel := TUniDBEdit(lControle.Value).FieldLabel + '<font color="Red"> *</font>'
      else
      if lControle.Value is TUniDBMemo then
        TUniDBMemo(lControle.Value).FieldLabel := TUniDBMemo(lControle.Value).FieldLabel + '<font color="Red"> *</font>'
      else
      if lControle.Value is TUniDBComboBoxValue then
        TUniDBComboBoxValue(lControle.Value).FieldLabel := TUniDBComboBoxValue(lControle.Value).FieldLabel + '<font color="Red"> *</font>'
      else
      if lControle.Value is TUniDBFormattedNumberEdit then
        TUniDBFormattedNumberEdit(lControle.Value).FieldLabel := TUniDBFormattedNumberEdit(lControle.Value).FieldLabel + '<font color="Red"> *</font>';
    end;
  end;
end;

 

Link to comment
Share on other sites

Dois minutos atrás, Picyka disse:

Oi, eu posso fazer um tipo de elenco em um para melhorar este código

 


class procedure TConfigureRequired.Configure(List: TDictionary<String, TComponent>; Dataset: TAureLiusDataSet);
begin
  for var lControle in List do
  begin
    if Dataset.FieldByName(lControle.Key).Required then
    begin
      if lControle.Value is TUniDBEdit then
        TUniDBEdit(lControle.Value).FieldLabel := TUniDBEdit(lControle.Value).FieldLabel + '<font color="Red"> *</font>'
      else
      if lControle.Value is TUniDBComboBoxObject then
        TUniDBComboBoxObject(lControle.Value).FieldLabel := TUniDBComboBoxObject(lControle.Value).FieldLabel + '<font color="Red"> *</font>'
      else
      if lControle.Value is TUniDBDateTimePicker then
        TUniDBDateTimePicker(lControle.Value).FieldLabel := TUniDBEdit(lControle.Value).FieldLabel + '<font color="Red"> *</font>'
      else
      if lControle.Value is TUniDBMemo then
        TUniDBMemo(lControle.Value).FieldLabel := TUniDBMemo(lControle.Value).FieldLabel + '<font color="Red"> *</font>'
      else
      if lControle.Value is TUniDBComboBoxValue then
        TUniDBComboBoxValue(lControle.Value).FieldLabel := TUniDBComboBoxValue(lControle.Value).FieldLabel + '<font color="Red"> *</font>'
      else
      if lControle.Value is TUniDBFormattedNumberEdit then
        TUniDBFormattedNumberEdit(lControle.Value).FieldLabel := TUniDBFormattedNumberEdit(lControle.Value).FieldLabel + '<font color="Red"> *</font>';
    end;
  end;
end;

 

Eu não poderia descobrir onde FieldLabel nasceu, talvez a solução está lá

Link to comment
Share on other sites

5 hours ago, picyka said:

Hi, I can do a type cast on one to improve this code

 




class procedure TConfigureRequired.Configure(List: TDictionary<String, TComponent>; Dataset: TAureLiusDataSet);
begin
  for var lControle in List do
  begin
    if Dataset.FieldByName(lControle.Key).Required then
    begin
      if lControle.Value is TUniDBEdit then
        TUniDBEdit(lControle.Value).FieldLabel := TUniDBEdit(lControle.Value).FieldLabel + '<font color="Red"> *</font>'
      else
      if lControle.Value is TUniDBComboBoxObject then
        TUniDBComboBoxObject(lControle.Value).FieldLabel := TUniDBComboBoxObject(lControle.Value).FieldLabel + '<font color="Red"> *</font>'
      else
      if lControle.Value is TUniDBDateTimePicker then
        TUniDBDateTimePicker(lControle.Value).FieldLabel := TUniDBEdit(lControle.Value).FieldLabel + '<font color="Red"> *</font>'
      else
      if lControle.Value is TUniDBMemo then
        TUniDBMemo(lControle.Value).FieldLabel := TUniDBMemo(lControle.Value).FieldLabel + '<font color="Red"> *</font>'
      else
      if lControle.Value is TUniDBComboBoxValue then
        TUniDBComboBoxValue(lControle.Value).FieldLabel := TUniDBComboBoxValue(lControle.Value).FieldLabel + '<font color="Red"> *</font>'
      else
      if lControle.Value is TUniDBFormattedNumberEdit then
        TUniDBFormattedNumberEdit(lControle.Value).FieldLabel := TUniDBFormattedNumberEdit(lControle.Value).FieldLabel + '<font color="Red"> *</font>';
    end;
  end;
end;

 

Hi

Can you try below code?

type
  THackFormControl = class(TUniFormControl);


THackFormControl(lControle.Value).FieldLabel := THackFormControl(lControle.Value).FieldLabel  + '<font color="Red"> *</font>';

 

Link to comment
Share on other sites

7 hours ago, Hayri ASLAN said:

Hi

Can you try below code?


type
  THackFormControl = class(TUniFormControl);


THackFormControl(lControle.Value).FieldLabel := THackFormControl(lControle.Value).FieldLabel  + '<font color="Red"> *</font>';

 

Perfect thank you.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...