Jump to content

Recommended Posts

Posted

Howdy, hopefully simple question. I have TUniCanvas up and running, and am able to save pen strokes. They seem to be written on a black background. Is this able to be set to another color such as white? the pen stroke color  is easily changeable. Here's a screen snap of a scribble. Many Thanks.

 

snap081.png.19752eb4169cd7edbdba17be036f1bff.png

Posted
On 3/30/2020 at 8:34 PM, dkeene said:

They seem to be written on a black background. Is this able to be set to another color such as white?

Hello,

UniCanvas.Color = clWhite ?

  • 2 years later...
Posted

Hello @pro_imaj

7 minutes ago, pro_imaj said:

No matter what I do with the background color, the picture background is always saved as black. is there a solution for this?

Do you have a simple testcase to reproduce?

Posted
56 minutes ago, Sherzod said:

Hello @pro_imaj

Do you have a simple testcase to reproduce?

@Sherzod 

Unfortunately, my main project has a black background.

When I create sample projects, it comes out with the same codes as you wrote.

Could it be caused by a setting on the servermodule or mainmodule side?

Posted
11 minutes ago, pro_imaj said:

but it doesn't work in my project, the background is always recorded as black in my project.

Well, we don't know your project and how you save the canvas in your case.

Try to reproduce a simple testcase we will see your issue.

Posted
1 hour ago, Sherzod said:

but it doesn't work in my project, the background is always recorded as black in my project.

@ Şerzod

Hi,

I managed to create the problem, Attached you can see the test file.

The source of the problem is: The screen while drawing is normally green, but the background of the picture is black, the source of the problem is the Showmodal pop-up screen.

This problem occurs when I do FShowModal2.WindowState := wsMaximized How can i solve it.

Test.zip

Posted

UniCanvas1.ClientEvents.ExtEvents ->

function afterrender(sender, eOpts)
{
    sender.getEl().on('resize', function(){
        ajaxRequest(sender, '_clear', {})
    });
}

UniCanvas1.OnAjaxEvent ->

procedure TFSerbestCizim.UniCanvas1AjaxEvent(Sender: TComponent;
  EventName: string; Params: TUniStrings);
begin
  if EventName = '_clear' then
  begin
    (Sender as TUniCanvas).Clear
  end;

end;

 

  • Thanks 1
Posted
53 minutes ago, Sherzod said:

UniCanvas1.ClientEvents.ExtEvents ->

function afterrender(sender, eOpts)
{
    sender.getEl().on('resize', function(){
        ajaxRequest(sender, '_clear', {})
    });
}

UniCanvas1.OnAjaxEvent ->

procedure TFSerbestCizim.UniCanvas1AjaxEvent(Sender: TComponent;
  EventName: string; Params: TUniStrings);
begin
  if EventName = '_clear' then
  begin
    (Sender as TUniCanvas).Clear
  end;

end;

 

@Sherzod

Thanks for the solution, I've implemented it for now.

I think you will inform the team for permanent solution.
You're welcome, I'm grateful.

  • Upvote 1
Posted
1 hour ago, Sherzod said:

UniCanvas1.ClientEvents.ExtEvents ->

function afterrender(sender, eOpts)
{
    sender.getEl().on('resize', function(){
        ajaxRequest(sender, '_clear', {})
    });
}

UniCanvas1.OnAjaxEvent ->

procedure TFSerbestCizim.UniCanvas1AjaxEvent(Sender: TComponent;
  EventName: string; Params: TUniStrings);
begin
  if EventName = '_clear' then
  begin
    (Sender as TUniCanvas).Clear
  end;

end;

 

@Sherzod

 

Changing the background color does not work when you add the codes you wrote, this problem occurs when you add your codes, I added an example.

image.thumb.png.a132f99c25b2722c13302ca36823e2e5.png

Test.zip

Posted
8 hours ago, pro_imaj said:

Test.zip 31.41 kB · 1 download

procedure TFSerbestCizim.btnVazgecClick(Sender: TObject);
begin

  UniCanvas1.Color := clRed;
  UniCanvas1.Clear; //<--------

  //  FncUMGenel_ShowModal_Kapat(UniMainModule.ShowModalEkranNo,
  //    UniMainModule.SonucKod, UniMainModule.SonucAciklama);
end;

 

Posted
5 hours ago, Sherzod said:
procedure TFSerbestCizim.btnVazgecClick(Sender: TObject);
begin

  UniCanvas1.Color := clRed;
  UniCanvas1.Clear; //<--------

  //  FncUMGenel_ShowModal_Kapat(UniMainModule.ShowModalEkranNo,
  //    UniMainModule.SonucKod, UniMainModule.SonucAciklama);
end;

 

@Sherzod

In your proposed solution; If the user wants to change the background color while drawing, you are clearing all their drawings, is there any way without clearing the drawings?

Posted
1 hour ago, pro_imaj said:

In your proposed solution; If the user wants to change the background color while drawing, you are clearing all their drawings, is there any way without clearing the drawings?

Yes, this is impossible, in one canvas there is no concept of layering...

  • Like 1

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...