Jump to content

Recommended Posts

Posted

I put a unipanel on form and set draggable property true then I changed onEndDrag event as above. But Panel's position not changed after the drag.

 

procedure TMainForm.UniPanel1EndDrag(Sender: TUniControl; Left, Top: Integer);
begin
  UniPanel1.Left := 200;
  UniPanel1.Top  := 200;
end;
 
  • Upvote 1
Posted

Hi,

 

For now try this...:

procedure TMainForm.UniPanel1AjaxEvent(Sender: TComponent; EventName: string;
  Params: TUniStrings);
var
  _left, _top: Integer;
begin
  if EventName = 'setLT' then
  begin
    _left := StrToInt(Params.Values['left']);
    _top := StrToInt(Params.Values['top']);

    with (Sender as TUniControl) do
    begin
      Left := _left;
      Top := _top;
    end;
  end;
end;
procedure TMainForm.UniPanel1EndDrag(Sender: TUniControl; Left, Top: Integer);
begin
  Sender.Left := Left;
  Sender.Top := Top;
  
  //Sender.Left := 200;
  //Sender.Top := 200;
  
  Sender.JSInterface.JSCode('var me='#1'; Ext.defer(function(){'+
                            'me.setPosition(200,200); '+
                            'ajaxRequest(me, "setLT", ["left=200", "top=200"])}, 20);');
end;

Best regards.

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