Hello use unigui web application Framework 1.90.0 build 1505
I have this function that returns the position of the mouse click and positions the panel at the x and y coordinate. But I want to take a certain object that I will enter the name, then I want it to position next to it. Could you give me an example?
procedure TMainForm.UniPanel2Click(Sender: TObject);
var
i: integer;
begin
for i := 1 to 3 do
begin
pStatus := TUniPanel.Create(MainForm);
with pStatus do
begin
Name := 'Option_' + inttostr(i);
caption := name;
Parent := sb;
Top := i * 41;
Height := 40;
align := altop;
color := RGB(Random(255), Random(255), Random(255));
OnAjaxEvent := pAjaxEvent;
ClientEvents.ExtEvents.Values['mousedown'] := 'function mousedown(sender, x, y, eOpts){ajaxRequest(sender, "_mousedown", ["x="+parseInt(x+sender.getX()), "y="+parseInt(y+sender.getY())])}';
end;
end;
end;
procedure TMainForm.pAjaxEvent(Sender: TComponent; EventName: string;
Params: TUniStrings);
var
p: TUniPanel;
x,y: Integer;
begin
if EventName = '_mousedown' then
begin
x := Params.Values['x'].ToInteger();
y := Params.Values['y'].ToInteger();
p := findcomponent((Sender as TComponent).Name) as TUniPanel;
unilabel2.Caption := p.Caption;
UniPanel3.Top := y;
UniPanel3.Left := x;
end;
end;