dkeene Posted March 30, 2020 Share Posted March 30, 2020 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. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 3, 2020 Share Posted April 3, 2020 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 ? Quote Link to comment Share on other sites More sharing options...
pro_imaj Posted September 27, 2022 Share Posted September 27, 2022 @Sherzod Hi No matter what I do with the background color, the picture background is always saved as black. is there a solution for this? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 27, 2022 Share Posted September 27, 2022 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? Quote Link to comment Share on other sites More sharing options...
pro_imaj Posted September 27, 2022 Share Posted September 27, 2022 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? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 27, 2022 Share Posted September 27, 2022 @pro_imaj Have you tried this? On 4/3/2020 at 2:14 PM, Sherzod said: UniCanvas.Color = clWhite ? Quote Link to comment Share on other sites More sharing options...
pro_imaj Posted September 27, 2022 Share Posted September 27, 2022 4 minutes ago, Sherzod said: @pro_imaj Have you tried this? @Sherzod Yes, this works, I tried it while making a test case, but it doesn't work in my project, the background is always recorded as black in my project.😪 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 27, 2022 Share Posted September 27, 2022 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. Quote Link to comment Share on other sites More sharing options...
pro_imaj Posted September 27, 2022 Share Posted September 27, 2022 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 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 27, 2022 Share Posted September 27, 2022 @pro_imaj I found a workaround... Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 27, 2022 Share Posted September 27, 2022 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; 1 Quote Link to comment Share on other sites More sharing options...
pro_imaj Posted September 27, 2022 Share Posted September 27, 2022 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. 1 Quote Link to comment Share on other sites More sharing options...
pro_imaj Posted September 27, 2022 Share Posted September 27, 2022 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. Test.zip Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 27, 2022 Share Posted September 27, 2022 I will try to check tomorrow. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 28, 2022 Share Posted September 28, 2022 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; Quote Link to comment Share on other sites More sharing options...
pro_imaj Posted September 28, 2022 Share Posted September 28, 2022 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? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 28, 2022 Share Posted September 28, 2022 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... 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.