erich.wanker Posted April 9, 2014 Share Posted April 9, 2014 hello :-) i want to move different Tunipanels with mouse.. i think, the OnMouseDown event is perfect ;-) .. but how can i send the mousemovement to the uniPanel? .. any Ideas? ThanX for help i create a lot of TuniPanels in a loop: .. tag-value amd hint value of TuniPanel are used for identivication ... aktuell_button:=TuniPanel.Create(self); aktuell_button.Cursor:=crHandPoint; aktuell_button.Top:=10; aktuell_button.Left:=10; aktuell_button.Width:=10; aktuell_button.Height:=10; aktuell_button.BorderStyle:=ubsnone; aktuell_button.ShowCaption:=false; aktuell_button.Color:=$00EBEBEB; aktuell_button.Parent:=mainpanel; aktuell_button.OnClick:=click_objekt; aktuell_button.OnMouseDown:=down_objekt; my OnClick procedure Tfenster.click_objekt(Sender:TObject); begin showmessage('buttonklick '+(sender as TuniPanel).hint); end; my OnMouseDown: procedure Tfenster.down_objekt(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin (sender as TuniPanel). ????? end; Link to comment Share on other sites More sharing options...
Sherzod Posted April 10, 2014 Share Posted April 10, 2014 Hi erich.wanker. i want to move different Tunipanels with mouse...If I understand correctly, try use Ext.dd.DDProxy: UniSession.AddJS('Ext.get("' + aktuell_button.JSName + '_id").dd = new Ext.dd.DDProxy(''' + aktuell_button.JSName + '_id'', '''');'); aktuell_button:=TuniPanel.Create(self); aktuell_button.Cursor:=crHandPoint; aktuell_button.Top:=10; aktuell_button.Left:=10; aktuell_button.Width:=10; aktuell_button.Height:=10; aktuell_button.BorderStyle:=ubsnone; aktuell_button.ShowCaption:=false; aktuell_button.Color:=$00EBEBEB; aktuell_button.Parent:=mainpanel; //aktuell_button.OnClick:=click_objekt; //aktuell_button.OnMouseDown:=down_objekt; UniSession.AddJS('Ext.get("' + aktuell_button.JSName + '_id").dd = new Ext.dd.DDProxy(''' + aktuell_button.JSName + '_id'', '''');'); Sincerely Link to comment Share on other sites More sharing options...
erich.wanker Posted April 10, 2014 Author Share Posted April 10, 2014 Hello and thanX Works great ... thank you ! please -can i ask another question? after i move a panel - i want to read his new position but with delphi-code it didnt work.. if i read (sender as TuniPanel).left i get allways the same value (the "onCreate"-value..) procedure Tfenster.click_objekt(Sender:TObject); begin //(sender as TuniPanel) showmessage(inttostr((sender as TuniPanel).left)); end; do you have a idea how i can output the new value after clicking one of the buttons ? thank you Erich Link to comment Share on other sites More sharing options...
Sherzod Posted April 10, 2014 Share Posted April 10, 2014 after i move a panel - i want to read his new position but with delphi-code it didnt work.. 1. procedure pAjaxEvent(Sender: TComponent; EventName: string; Params: TStrings); 2. procedure TMainForm.pAjaxEvent(Sender: TComponent; EventName: string; Params: TStrings); begin if EventName = '_after_move' then begin //ShowMessage(Params.Values['xpos']); (Sender as TUniPanel).Left := StrToInt(Params.Values['xpos']); (Sender as TUniPanel).Top := StrToInt(Params.Values['ypos']); ShowMessage(IntToStr((Sender as TUniPanel).Left) + ' ' + IntToStr((Sender as TUniPanel).Top)); end; end; 3. aktuell_button:=TuniPanel.Create(self); aktuell_button.Cursor:=crHandPoint; aktuell_button.Top:=10; aktuell_button.Left:=10; aktuell_button.Width:=10; aktuell_button.Height:=10; aktuell_button.BorderStyle:=ubsnone; aktuell_button.ShowCaption:=false; aktuell_button.Color:=$00EBEBEB; aktuell_button.Parent:=mainpanel; //aktuell_button.OnClick:=click_objekt; //aktuell_button.OnMouseDown:=down_objekt; aktuell_button.OnAjaxEvent := pAjaxEvent; UniSession.AddJS('Ext.get("' + aktuell_button.JSName + '_id").dd = new Ext.dd.DDProxy(''' + aktuell_button.JSName + '_id'', '''');'); UniSession.AddJS('Ext.apply(Ext.get("' + aktuell_button.JSName + '_id").dd, {afterDrag:function() {ajaxRequest(' + aktuell_button.JSName + ', ''_after_move'', [''xpos='' + (Ext.get("' + aktuell_button.JSName + '_id").getX() - MainForm.form.getX()), ''ypos='' + (Ext.get("' + aktuell_button.JSName + '_id").getY() - MainForm.form.getY())])}});'); Link to comment Share on other sites More sharing options...
erich.wanker Posted April 11, 2014 Author Share Posted April 11, 2014 Hello and thank you again for your time and help :-) ... but i can not bring it to run :-( ... the Ext.dd.DDProxy works fine .. i can move different panels .. works fine :-) but the second part .. the "afterDrag" .. i tried a little bit to bring it to run ..but no success ... Thanx for suggestions and nice greetings from gastein Erich Link to comment Share on other sites More sharing options...
Sherzod Posted April 11, 2014 Share Posted April 11, 2014 may be problem in the name MainForm Link to comment Share on other sites More sharing options...
erich.wanker Posted April 11, 2014 Author Share Posted April 11, 2014 :-) :-) :-) :-) :-) :-) :-) sorry for this simple error ... you are right ... i am a idiot ... i read this line 100 times .. and it is 100% clear that i must use my formname .. Thank you again :-) Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now