FFREDIANELLI Posted May 7, 2019 Share Posted May 7, 2019 Please how can I know the position of a button created dinamicaly inside a panel, that is inside other panel, and scrollbox, all of them created dinamicaly ? I need to open an options form closer to the button, so I think that i need the x,y position of the form, because the left and right position of the button is relative to the panel, that is inside a scroll box so i can not calculate the position based in summing the position of the parent components... If its not possible i will create in the center... not so profissional... but will work.. Quote Link to comment Share on other sites More sharing options...
Abaksoft Posted May 7, 2019 Share Posted May 7, 2019 Can you explain what are the benefits of creating components dynamically ? Quote Link to comment Share on other sites More sharing options...
FFREDIANELLI Posted May 7, 2019 Author Share Posted May 7, 2019 None..., but there is no other way to create a similar funcionality of the site monday.com, i'm almost there... but for some interface things i dont know how to do it... as you can see in the image i can not use unidbgrid becase the kind of components that can compose a pulse are variable project by project, and board by board. So, for example the user will click on the panel red status and i whant to present the possible status 'near' this panel... just this. each line is a panel with componets created dinamicaly . and why not pay monday.com, because it will not integrate with out industrial cost system and production system, (ERP). Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 7, 2019 Share Posted May 7, 2019 4 hours ago, FFREDIANELLI said: Please how can I know the position of a button created dinamicaly inside a panel, that is inside other panel, and scrollbox, all of them created dinamicaly ? I need to open an options form closer to the button, so I think that i need the x,y position of the form, because the left and right position of the button is relative to the panel, that is inside a scroll box so i can not calculate the position based in summing the position of the parent components... If its not possible i will create in the center... not so profissional... but will work.. Hi, Can you explain in more details what you wanted to implement? Make a simple testcase for this if possible Quote Link to comment Share on other sites More sharing options...
FFREDIANELLI Posted May 7, 2019 Author Share Posted May 7, 2019 I will try to create a testcase, i need to create a form near the button pressed like in this image, the problem is that this button was created dynamicaly and inside a scrollbox... Quote Link to comment Share on other sites More sharing options...
FFREDIANELLI Posted May 7, 2019 Author Share Posted May 7, 2019 Here is the testcase Sherzod, thanks for any help. Dinamico.rar Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 7, 2019 Share Posted May 7, 2019 16 minutes ago, FFREDIANELLI said: Here is the testcase Sherzod, thanks for any help. OK thanks, I will check Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 7, 2019 Share Posted May 7, 2019 37 minutes ago, FFREDIANELLI said: Here is the testcase Sherzod, thanks for any help. You can try something like this: foptions -> Position -> poDefault procedure pAjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); 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; foptions.unilabel2.Caption := p.Caption; foptions.Top := y; foptions.Left := x; foptions.ShowModal(); end; end; procedure TMainForm.UniPanel1Click(Sender: TObject); var i: integer; begin for i := 1 to 25 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)); //onclick := pstatusClick; 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; 1 Quote Link to comment Share on other sites More sharing options...
FFREDIANELLI Posted May 8, 2019 Author Share Posted May 8, 2019 Perfect !!! Many Thanks again !!! 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.