Jump to content

pro_imaj

uniGUI Subscriber
  • Posts

    929
  • Joined

  • Last visited

  • Days Won

    5

Posts posted by pro_imaj

  1. 1 hour ago, pro_imaj said:

    Hi

    When I run the code below, the code in line 2 works and closes the form, without SubmitData in line 1 working.

    How do I get it to work sorted in Unigui?

       UniCanvas1.SubmitData;
       TuniForm(Owner).Close;

    I fixed the problem by adding the form close function to the end of the UniCanvas1AfterSubmit event.

  2. 10 hours ago, Ron said:

    By adding these lines you can export the canvas data to the server:

    uses NetEncoding;
    
    procedure TMainForm.UniButton1Click(Sender: TObject);
    begin
      uniSession.AddJS('ajaxRequest(MainForm.form, [''export''], { data: canvas.toDataURL() } );');
    end;
    
    procedure TMainForm.UniFormAjaxEvent(Sender: TComponent; EventName: string;
      Params: TUniStrings);
    var inStream, outStream:TStringStream;
    begin
      if sameText(eventName,'export') then
      begin
        inStream:=TStringStream.Create;
        outStream:=TStringStream.Create;
        inStream.writeString(params.Values['data']);
        inStream.position:=22;
        TNetEncoding.Base64.Decode(inStream, outStream);
        outStream.position:=0;
        uniImage1.Picture.LoadFromStream(outStream);
        uniImage1.Picture.SaveToFile('image.png');
        inStream.Free;
        outStream.Free;
      end;
    end;

     

    Update: moved beginPath and closePath to mouseDown and mouseUp, for more fluid drawing.

    For clearing the canvas use:

    uniSession.AddJS('ctx.clearRect(0, 0, canvas.width, canvas.height);');

     

     

     

    mousemove_ex.zip 55.33 kB · 1 download

    signature.jpg

    Hi @Ron,

    Reply, thank you for the example, I appreciate it.

    In this example, since the user can use different colors while drawing, everything on the screen changes when I change the Color, how can I change the color without wiping the screen?

    What I'm doing is briefly HTMLFrame.HTML.Text := memBlack.Text;
    I have attached an example.

    mousemove_ex.zip

  3. 5 hours ago, Ron said:

    As long as you do not need mouse move data, you can solve it all in Unigui. Like creating objects and placing them, or creating a line between two points, as you then only need to catch mousedown/up events.

    But if you want to draw freehand lines, then you need mouse move data, which cannot be sent to the server as it is just too much, so it has to be solved in the client using JS.

    Mouse move data is the red line, and if you do not need to cross it, things will be easier.

    Is there a sample application on this subject has been done and shared before.

    This is not the main topic of my project but I need something like this in some part.

  4. 2 hours ago, Sherzod said:

    Ok @pro_imaj Thank you.

    We will check.

    This problem may not be related to UniDBTagField, in the example I sent you, when I add UniDbCheckCombobox instead of UniDBTagField, there is no problem while recording and that blank screen does not appear, yes, but when I open it in edit mode, the relevant data does not appear.

    It's as if the situation is related to a bug caused by unigui regarding my opening Frame in a Form.

  5. 17 minutes ago, Sherzod said:

    @pro_imaj

    Are there any errors in the logs, in the browser console?

    Hi @Sherzod

    Unfortunately not, there is no problem with any log files or debug mode.
    I'm sure there is a big bug in this component.

    Instead, I used UniDBCheckCombobox without changing any code and got the result without any problems.

    Since the UniDbTag component is much more useful, I want to use it, otherwise I solved my problem with UniDBCheckCombobox.

  6. 12 minutes ago, pro_imaj said:

    Also, there is a bug in UniDBTagField component and it affects the whole project.

    If the user writes and saves anything that is not in the list, then no frame can be opened in the project, which is a very big problem.

    After this event, when I try to open a frame in the Form, something like this appears.

    A frame opens in a form that normally has the System Close button

    image.png

  7. I found the source of the problem with CreateOrder;

    When processing with CreateOrder, it should be started from 1, since I start from 0, edits are not positioned when 0 in all other objects.

    This is not a definitive solution, normally it should have been resolved with TabControl.

    Thanks for your help. @Sherzod

×
×
  • Create New...