eduardosuruagy Posted February 25, 2019 Share Posted February 25, 2019 I would like to click on line 0 (fixed) of a StringGrid and get the value of the column, the zero line is the fixed line of the StringGrid. Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted February 25, 2019 Author Share Posted February 25, 2019 Does anyone have an idea how I can do this? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 25, 2019 Share Posted February 25, 2019 5 hours ago, eduardosuruagy said: I would like to click on line 0 (fixed) of a StringGrid and get the value of the column, the zero line is the fixed line of the StringGrid. Hi, Can you please explain your question again? Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted February 25, 2019 Author Share Posted February 25, 2019 What I want is to double click on the column "Col3" and get the description of the column that would be "Col3" if I give two clicks on another column would be the same, would take the description... Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 25, 2019 Share Posted February 25, 2019 51 minutes ago, eduardosuruagy said: What I want is to double click on the column "Col3" and get the description of the column that would be "Col3" if I give two clicks on another column would be the same, would take the description... One possible solution 1. function headerclick: function headerclick(ct, column, e, t, eOpts) { var timeNow = (new Date()).getTime(); if (this.lastClicked) { if (timeNow > (this.lastClicked + 200)) { } else { ajaxRequest(this, "columndblclick", ["columntext=" + column.text, "columnindx=" + column.dataIndex]); } } this.lastClicked = timeNow; } 2. OnAjaxEvent: procedure TMainForm.UniStringGrid1AjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); begin if EventName = 'columndblclick' then begin ShowMessage(Params.Values['columntext'] + ',' + Params.Values['columnindx']); end; end; Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted February 25, 2019 Author Share Posted February 25, 2019 Double clicking did not work here Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted February 25, 2019 Author Share Posted February 25, 2019 Only triggers the select event Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 26, 2019 Share Posted February 26, 2019 20 hours ago, eduardosuruagy said: Double clicking did not work here Make a simple testcase if possible Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted February 26, 2019 Author Share Posted February 26, 2019 Just use the example that comes in the unigui installation folder, if you look at the image I used the mdemo example. Another thing, I have the first 3 fixed columns, the first and second I quertia that had the width of 30 centralized and the third of the size of 250 aligned to the left and the other columns that were added dynamically had the width of centralized 30 How do I do this? In the ClientEvents.ExtEvents.reconfigure I put the code below, but it did not work: function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts) { columns[0].maxWidth = 30; columns[0].rdonly = true; columns[0].align = 'center'; columns[1].maxWidth = 30; columns[1].rdonly = true; columns[1].align = 'center'; columns[2].maxWidth = 250; columns[2].rdonly = true; columns.forEach(function(el){el.flex=1}); /* for (i = sender.fxCols; i < columns.length; i++) { if (i > 2) { columns.rdonly = true; columns.maxWidth = 70; columns.align = 'center'; } } */ } Please help me, I've been trying to solve this for days and I can not Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 26, 2019 Share Posted February 26, 2019 Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted February 26, 2019 Author Share Posted February 26, 2019 I think the problem is that this example already the columns are already fixed and in my I include them automatically, if you take the example of unit GridsStringGrid that is in the project mmdemo and put 3 fixed columns you will see that the event headerclick he does not shoot. As I told you, I do the grid automatically, they are 3 fixed columns and the rest I am adding as the user wants. What tool do you use to record this video? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 26, 2019 Share Posted February 26, 2019 38 minutes ago, eduardosuruagy said: What tool do you use to record this video? LICEcap Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted February 26, 2019 Author Share Posted February 26, 2019 I want to click on the column and put the column rows into editing, but only one column can be edited at a time and when I click again on the column I remove the edit from the rows of it, I tried to do that. Unigui StringGrid.rar Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 26, 2019 Share Posted February 26, 2019 28 minutes ago, eduardosuruagy said: I want to click on the column and put the column rows into editing, but only one column can be edited at a time and when I click again on the column I remove the edit from the rows of it, I tried to do that. Does your code work in VCL? Sorry, can you also make a simple testcase for VCL? Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted February 26, 2019 Author Share Posted February 26, 2019 Exemplo VCL Exemplo String Grid.rar Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 27, 2019 Share Posted February 27, 2019 Ok, do you want the same functionality? But I don't see you using dblclick somewhere Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted February 27, 2019 Author Share Posted February 27, 2019 Whether it's a click or two clicks, what I want is to get the value of the column clicked like I did in the VCL project. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 27, 2019 Share Posted February 27, 2019 1 minute ago, eduardosuruagy said: Whether it's a click or two clicks, what I want is to get the value of the column clicked like I did in the VCL project. OK I will try to understand and analyze, and let you know Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted February 27, 2019 Author Share Posted February 27, 2019 See the example in VLC running Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted February 27, 2019 Author Share Posted February 27, 2019 On 2/26/2019 at 2:33 PM, Sherzod said: I was able to do that way you showed here, now how do I change the caption of the column clicked? Quote Link to comment Share on other sites More sharing options...
newsanti Posted May 4, 2023 Share Posted May 4, 2023 On 2/26/2019 at 2:44 AM, Sherzod said: One possible solution 1. function headerclick: function headerclick(ct, column, e, t, eOpts) { var timeNow = (new Date()).getTime(); if (this.lastClicked) { if (timeNow > (this.lastClicked + 200)) { } else { ajaxRequest(this, "columndblclick", ["columntext=" + column.text, "columnindx=" + column.dataIndex]); } } this.lastClicked = timeNow; } 2. OnAjaxEvent: procedure TMainForm.UniStringGrid1AjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); begin if EventName = 'columndblclick' then begin ShowMessage(Params.Values['columntext'] + ',' + Params.Values['columnindx']); end; end; EventName = columndblclick not fire. StringGrid2.zip Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 4, 2023 Share Posted May 4, 2023 Hello, 1 minute ago, newsanti said: EventName = columndblclick not fire. Are you trying click or dblclick? Quote Link to comment Share on other sites More sharing options...
newsanti Posted May 13, 2023 Share Posted May 13, 2023 On 5/4/2023 at 10:23 PM, Sherzod said: Hello, Are you trying click or dblclick? Click or DblClick on HeaderClick ...EventName is click only. Quote Link to comment Share on other sites More sharing options...
newsanti Posted May 13, 2023 Share Posted May 13, 2023 OnMouseDown...Y<=30 ... determine is ColumnTitle Click. How to translate X to Grid ColumnIndex? function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts) { columns.forEach(function(col) { if (col.titleEl) { col.titleEl.on('click', function() { ajaxRequest(sender, 'headerclick', ['colIndx=' + col.dataIndex]); }) } }); } procedure Grid1AjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); begin if EventName = 'headerclick' then begin var oColumnIndex:= StrToInt(Params.Values['colIndx']); if oColumnIndex>=0 then ... end end; Work Perfect. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 14, 2023 Share Posted May 14, 2023 On 5/4/2023 at 8:21 PM, newsanti said: EventName = columndblclick not fire. StringGrid2.zip 122.61 kB · 0 downloads I haven't seen your test case yet. I will try to look and test. 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.