Topic: Grid Single Click

Hi All,
Is there any way to make it so the user can single click on a row in a Table Grid to go to the form or record instead of having to double click on the row?
-
Thanks, Frank

2 (edited by derek 2020-09-05 19:21:27)

Re: Grid Single Click

Hi Frank,
It can be done with a line of script (please see attached).
However, you then have to address the issue of how you want to handle deletions - normally, you (single) click on a row in the tablegrid to give that row focus, and then you click 'delete'.............however, your 'single click' is now taking the user to edit that row!  (there are ways around it but they involve a bit more script).
If you need any further help, just shout.
Derek.

Post's attachments

Attachment icon frank single click.zip 1.18 mb, 314 downloads since 2020-09-05 

Re: Grid Single Click

Thanks Derek
It's what I wanted to do, but I hadn't thought about the deleting a record issue.
-
I did notice that if I click on a record in form1 it does take me to form2, as it should.
Then when I close form2 and go back to form1, that the record I had chosen is still highlighted.
Now when I click on the delete button, it does delete the record on form1.
-
That does work, but since it's not going to be obvious to the user, I don't think it would be a good solution in my opinion.
-
I do have quite a few tablegrids so trying to implement a one-click solution to all of them looks like it might be quite a hassle.
-
So I'm thinking that the double-click method is not so bad and is probably the better way to go.
-
Thanks for you response, Frank

4 (edited by derek 2020-09-05 20:52:03)

Re: Grid Single Click

Hi Again Frank,
I think I was having a 'senior moment' (again!).
The obvious way to get around the deletion problem (without script) is to tick 'allowdelete' in the 'editable' properties of the tablegrid (see screenshot) and remove the 'delete' button (to avoid any confusion).
Now if you want to edit a record, you can single click on it and if you want to delete a record, you can single right click on it.   
Sorry about that.
Derek.

Post's attachments

Attachment icon frank delete.jpg 198.31 kb, 103 downloads since 2020-09-05 

5 (edited by papafrankc 2020-09-05 21:54:11)

Re: Grid Single Click

Derek,
"Senior Moments" have been part of my life for quite a while now.  This getting older bit has its drawbacks. sad
-
The right-click sure does work and is a pretty simple solution.
-
However, I'm thinking that solution might not be the best for the novice computer user.  I would guess that most users are familiar with the double-click procedure on a computer but many of them might not be that familiar with the right-click feature?
-
My goal is to keep everything as simple as possible.  Mostly with buttons that folks can click to do things. I currently have a label that says to double-click on a user to go to the main menu for that user.  I also have a delete-user button that lets the user delete that record.  So if they highlight a user, then click Delete, that will delete that user and all of the associated child records.
-
I'm thinking that this is probably the best way to go, unless you have any other suggestions.
-
Thanks for all you do for us wanna be programmers, Frank

Re: Grid Single Click

Getting old isn't for the faint-hearted - LOL!!
I think I went through the same 'hoop' quite a while ago trying to use single click everywhere but it ended up causing more problems than it was solving (you can't easily sort columns by clicking on the column header as it interprets that as wanting to edit a record etc etc).
So in the end, I just went with the double click - still, it was a good learning exercise along the way.
Derek.

Re: Grid Single Click

Frank & Derek,
I recently developed a carryout dinner system for a local business. There are different stations in the process from order takers to preparers to deliverers, each using tablets without keyboards. It was easier for the end user to do single clicks in tablegrids. If you use the tablegrid cell click event rather than the tablegrid click event, you can still click the headers for sorting. I placed the record delete button on the order update form and created a very small script to do the deletion.  Frank, don't be afraid to do some scripting. Sometimes a little work on our part can make it a lot easier on the end user. I knew nothing about pascal before MVD and I am still learning some aspects of it as it relates to MVD. I maintain a code snippet database that I use for a reference guide if I forget something. Happy Computing!

8 (edited by papafrankc 2020-09-07 00:24:19)

Re: Grid Single Click

ehw,

Thanks for the tip about the OnCellClick event.  I tried it and it does work as you say.
-
There's a couple of issues I've noticed.
1st - when I single click on a record in my table, the Windows Hour Glass appears and kinda jumps around for a second or two before it goes to my next form.  It doesn't prevent it from working but it just looks strange.  It sort of looks to me like it is doing some extra processing before it opens up the next form.  On my other Table Grids, when I Double-Click it goes directly to the next form without any hourglass.
UPDATE I took out the single click and the hourglass still appears.  Maybe it's been doing it all along and I never noticed it before.  However it seems to do it only on the FIRST form.  I don't see it on the other table grids. Maybe the aliens are back smile
-
2nd - I do have a Delete button on my first form, however I can't use it without a record highlighted. And when I highlight a record it goes to the next form as it should per the OnCellClick.  However when I go back to the first form that record I selected is still highlighted.  So now I'm able to use the Delete button and the arrow keys. 
-
This is probably what you referred to when you said more scripting would be required for the delete function?
-
Since my Double-Click is working OK throughout my project, I'm inclined at this time to stay with it.  However I'm always open to suggestions.  And these suggestions from yourself and others have shown me things that I probably wouldn't have figured out by myself.
-
I realized at the beginning of my journey that I should learn Pascal in order to open up the full power of MVD.  I plan to do so as soon as I finish this project.
-
I've been really impressed with what I've been able to do with a minimal of scripting and the help from folks on the forum.  The power of MVD is impressive. 
-
Thanks, Frank

Re: Grid Single Click

I tried the single click and it works fine, the problem is that it blocks the "Edit" function and I cannot display the info for the edit.

Destiny

Re: Grid Single Click

Destiny,
What do you mean by "it blocks the Edit function"?


If you are looking to execute the edit on a single click, you can put into the script to click on the EDIT button in the OnCellClick event of the tablegrid.


procedure Form1_TableGrid1_OnCellClick (Sender: TObject; ACol, ARow: Integer);
begin
     Form1.btnEdit.click;
end;

Re: Grid Single Click

When I select a row in TableGrid1 it displays the information correctly but prevents the "Edit" button from working because in TableGrid1 the selected row is no longer active.

Destiny

Re: Grid Single Click

Did you apply the script I provided in my previous post?

procedure Form1_TableGrid1_OnCellClick (Sender: TObject; ACol, ARow: Integer);
begin
     Form1.btnEdit.click;
end;

Maybe you should attach your project so we can take a look at what you are referencing.

Re: Grid Single Click

Yes I applied the script you provided me but without result, even the "goMultiSlect" selection no longer works in TableGrid1.
I'll send you my project tomorrow.

Destiny

Re: Grid Single Click

Here is my project, you will see that there is no way to modify the data by clicking on "Edit" because the chosen row is deselected and I cannot delete it either.

Destiny

Post's attachments

Attachment icon Ma collection de timbres.zip 616.67 kb, 196 downloads since 2021-10-21 

Destiny

Re: Grid Single Click

Hello Destiny

Removes the button2 (MyTamps) it is he who makes the mess.
You can even display the data of the selected stamp on the MyStampCollection form, the Add form is duplicated.

Supprime le bouton2 (MesTimbres) c'est lui qui met la pagaille.
Tu peux même afficher les datas du timbre sélectionné sur le  formulaire  MaCollectiondeTimbres, la form Ajout fait doublon.

JB

Re: Grid Single Click

ReHello Destiny

I am correcting my previous post
It is not the button 2 that you have to delete.
Delete the procedure TimbredeFrance_TableGrid1_OnClick (Sender: TObject);
It is this which deactivates the selection of the line to display in your form.
Button 2 is useful since it opens the file storing your stamp images
Scuzzi

Je corrige mon post précédent
Ce n'est pas le button 2 que tu dois supprimer.
Supprime la procedure TimbredeFrance_TableGrid1_OnClick (Sender: TObject); (ou désactive la par la paire {..} ou une série de // en tête des lignes)
C'est elle qui désactive la sélection de la ligne à afficher dans ton formulaire.
Bouton 2 a son utilité puisque qu'il ouvre le fichier stockant tes images de timbres
Scuzzi

JB

Re: Grid Single Click

Hello Destiny

With MVD (version 6.6) I created my own application to manage my stamps (Only French stamps)
You will find in PJ the open gate in reception
JB

Avec MVD (version 6.6) j'ai créé ma propre application pour gérer mes timbres (Uniquement les timbres français)
Tu trouveras en PJ la grille uverte en accueil
JB

Post's attachments

Attachment icon Timbres_France.jpg 199.83 kb, 84 downloads since 2021-10-21 

Re: Grid Single Click

Hello Destiny

With MVD (version 6.6) I created my own application to manage my stamps (Only French stamps)
You will find in PJ the grid listing all stamps.
JB

Avec MVD (version 6.6) j'ai créé ma propre application pour gérer mes timbres (Uniquement les timbres français)
Tu trouveras en PJ la grille affichant tous les timbres.
JB

19 (edited by Destiny 2021-10-22 15:54:24)

Re: Grid Single Click

Je te remercie pour ta réponse, c'est effectivement le simple clic qui pose problème. Jai trouvé une alternative a ce problème, il suffit de faire un clic droit afin d'afficher les données pour les modifier (voir PJ).

J'aime bien la présentation de ton logiciel de timbres avec les icônes bien référencés et la vue immédiate des informations. Super.


Destiny

Post's attachments

Attachment icon Clic droit.jpg 49.59 kb, 81 downloads since 2021-10-22 

Destiny