Jump to content

the case on the caption panel


Point

Recommended Posts

Hello,

i have third party theme pack. the panel caption does not match with the original theme color. the panel caption always set to black. for this case I made a testcase using uni_sencha_classic.

still using 1555, I read the 1556 changelog there is no fix information for this case. need temporary solution.

Thanks.

 

themepanel.7z

Link to comment
Share on other sites

24 minutes ago, Point said:

i have third party theme pack. the panel caption does not match with the original theme color. the panel caption always set to black. for this case I made a testcase using uni_sencha_classic.

Hello,

Sorry, what should we pay attention to?

Link to comment
Share on other sites

hi @Sherzod, i am trying to use this approach :

function form.afterrender(sender, eOpts)
{
   const element = document.getElementById(sender.id + '-innerCt');
   const cssObj = window.getComputedStyle(element, 'x-panel-body-default');

   let aFontColor = cssObj.getPropertyValue("color");
   console.log(aFontColor);
   
   ajaxRequest(sender, 'onGetColor',['aclr=' + aFontColor]);
}

==

procedure TMainForm.UniFormAjaxEvent(Sender: TComponent; EventName: string;
  Params: TUniStrings);
begin
  if EventName = 'onGetColor' then begin
    pubColor := Params['aclr'].AsString;
  end;
end;

==

procedure TUniForm2.UniFormCreate(Sender: TObject);
begin
  //===> UniPanel2.Font.Color := MainForm.pubColor;
end;

===

result param rgb(53, 53, 53)

what kind function to convert rgb(53, 53, 53) color to TColor, the color must save in server side to avoid change back to black.

 

Link to comment
Share on other sites

done with this approach :

script :

function RGBToHex(rgb) {
  // Choose correct separator
  let sep = rgb.indexOf(",") > -1 ? "," : " ";
  // Turn "rgb(r,g,b)" into [r,g,b]
  rgb = rgb.substr(4).split(")")[0].split(sep);

  let r = (+rgb[0]).toString(16),
      g = (+rgb[1]).toString(16),
      b = (+rgb[2]).toString(16);

  if (r.length == 1)
    r = "0" + r;
  if (g.length == 1)
    g = "0" + g;
  if (b.length == 1)
    b = "0" + b;

  return "#" + r + g + b;
}


function form.afterrender(sender, eOpts)
{
   const abodypanel = document.getElementById(sender.id + '-body');
   const cssObj = window.getComputedStyle(abodypanel, 'x-panel-body-default');
   
   let aFontColor = cssObj.getPropertyValue('color');  
   ajaxRequest(sender, 'onGetColor',['aclr=' + RGBToHex(aFontColor)]);
}

===
MainForm
.
.
.
public
   pubPanelFontColor : TColor
end;  

function WebColorStrToColor(WebColor: string): TColor;
begin
  if (Length(WebColor) <> 7) or (WebColor[1] <> '#') then Result := clBlack;
  Result :=
    RGB(
      StrToInt('$' + Copy(WebColor, 2, 2)),
      StrToInt('$' + Copy(WebColor, 4, 2)),
      StrToInt('$' + Copy(WebColor, 6, 2)));
end;

procedure TMainForm.UniFormAjaxEvent(Sender: TComponent; EventName: string;
  Params: TUniStrings);
begin
  if EventName = 'onGetColor' then begin
    pubPanelFontColor := WebColorStrToColor(Params['aclr'].AsString);
  end;
end;

Other Form :

procedure TuniForm2.UniFormCreate(Sender: TObject);
begin
  APanel.Font.Color := MainForm.pubPanelFontColor;
end;

 @Farshad Mohajeriand @Sherzod, Please fix this issue for the next release.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...