1 (edited by tcoton 2023-12-19 18:24:36)

Topic: Hide a row or a specific record in frmdbCoreUserForm

Hi all,

I know it is possible to hide a column in a tablegrid but is it possible to hide a row or a specific record according an id in a tablegrid result?

Re: Hide a row or a specific record in frmdbCoreUserForm

tcoton wrote:

Hi all,

I know it is possible to hide a column in a tablegrid but is it possible to hide a row or a specific record according an id in a tablegrid result?

Form1.TableGrid1.RowVisible[i] := False;

Re: Hide a row or a specific record in frmdbCoreUserForm

As soon as you find the help hidden on the MVD website, from the very first page
you will discover magical DELPHI spells and formulas hidden from prying eyes and protected by DriveSoft.
Take care of the secret of Row and RowVisible, just as DriveSoft takes care of it.


Vladimir didn’t keep the secret. )

4 (edited by tcoton 2023-12-18 21:02:34)

Re: Hide a row or a specific record in frmdbCoreUserForm

Thanks pavlenko.vladimir.v.

Does anyone know how the user grid and the role combobox in the frmdbCoreUsers are called?
I am trying to hide one user and one role from prying eyes.
https://myvisualdatabase.com/forum/misc.php?action=pun_attachment&item=10159

Post's attachments

Attachment icon frmdbCoreUsers.png 101.38 kb, 14 downloads since 2023-12-18 

Re: Hide a row or a specific record in frmdbCoreUserForm

Hi,
The name of the grid is 'frmdbcoreusers.gridusers'
However, I can't find any reference to the name of the 'role' combobox on 'frmdbcoreuserform'.  I wrote a small program a while back to identify all the elements on the 'frmdbcore' suite of forms and the one element that it never found was the 'role' combobox which is puzzling.
Derek.

6 (edited by k245 2023-12-19 10:30:16)

Re: Hide a row or a specific record in frmdbCoreUserForm

Derek, You are absolutely right: this combobox does not have a name. But you can get to it through the form's components[] property
https://myvisualdatabase.com/forum/misc.php?action=pun_attachment&item=10160&download=0

For research, you can use Component Explorer, which is included in the free ClearApp program

https://k245.ru/en/software-en/clearapp-2.html

Post's attachments

Attachment icon изображение_2023-12-19_132414838.png 36.34 kb, 15 downloads since 2023-12-19 

Визуальное программирование: блог и телеграм-канал.

Re: Hide a row or a specific record in frmdbCoreUserForm

Hi all.


The combo is created on the form when the form starts.
You can refer to it as components[21]

Re: Hide a row or a specific record in frmdbCoreUserForm

Thanks guys.

@k425, I have downloaded the current available version of clearapp and I don't see the last line which you show on your screenshot.
I cannot read Russian but there is an absolute link instead of relative link to ".\Script\Tools\Dbg\resourses\clear.png" when clicking on the second item of first menu in the main form.

Re: Hide a row or a specific record in frmdbCoreUserForm

Well... I cannot get anything working to manipulate at least the frmdbCoreUserForm.combobox to not display the role with id=3

I have tried all number in components[] without a result.

This is where I am at:

 frmdbCoreUserForm.components[21].dbFilter:= 'id IS NOT 3';

and the error is always Undeclared identifier:'dbFilter'.... whichever the number

Re: Hide a row or a specific record in frmdbCoreUserForm

I don't know if I understood the question well. I am using a translator. To not display a specific record in a tablegrid, I place it in the tablegrid definition panel, in "3o. Filter (Not required)": id <> num_id and the same thing in the properties of a combobox in "Filter".

Roberto Alencar

11 (edited by tcoton 2023-12-19 19:41:22)

Re: Hide a row or a specific record in frmdbCoreUserForm

Yeah, actually I renamed the topic since we cannot interact with the frmdbCoreUsers.gridusers and actually it makes no sense to play with it since  the main issue is in the role combobox filtering in the frmdbCoreUserForm.

If the application has been compiled with a specific role and the role is deleted from the database afterward via sqlitestudio to hide it, the role will reappear in the database with a new id at next app launch. I do have buttons and fields reserved to developer in my app and I want to avoid anyone else to play with them. Without this restriction I must keep 2 versions of the app, 1 with the hidden dev features as well as no dev permissions and 1 without any of the dev features which is cumbersome.

It looks like the frmdbCoreUserForm combobox is a dynamic component and I don't get how to filter it.

Re: Hide a row or a specific record in frmdbCoreUserForm

It looks like the frmdbCoreUserForm combobox is a dynamic component and I don't get how to filter it.


I wrote it that way.

The combo is created on the form when the form starts.

And when this form is ready for display (or has already been created), the combo becomes available for working with it))).
In other cases, there is a component error with this index.

Re: Hide a row or a specific record in frmdbCoreUserForm

Hi Sparrow,
I understood this part, the problem is to know what is the name or the component reference of this combo!
There must be a reference to this combo somewhere, otherwise it could not exist or is there a trick to address an unnamed component in a form?

Re: Hide a row or a specific record in frmdbCoreUserForm

As Derek and Konstantin wrote, the component does not have a name.
And the dynamically CREATED component has index 21.
Therefore frmdbCoreUserForm.components[21] ... . This is how you can reference it.

Re: Hide a row or a specific record in frmdbCoreUserForm

But it does not work as I always get the error "Undeclared identifier:'dbFilter'.... " whichever the number.

At the end of the script before the final end.

I put

 frmdbCoreUserForm.components[21].dbFilter:= 'id IS NOT 3';


and it does not compile with the error "Undeclared identifier:'dbFilter'.... "

Re: Hide a row or a specific record in frmdbCoreUserForm

Hi,
Perhaps try it something like this (see attached).
In the example, I've added a new field ('roletohide') to the _user table to hold the role that needs to be hidden rather than hard coding it in the script.
It's a bit 'basic' (I'm busy with grandchildren and Christmas for my sins  big_smile and haven't much free time at the moment) but hopefully it gives you some ideas.
The passwords for all users is 'password' apart from Admin which is 'admin'.
Regards,
Derek.

Post's attachments

Attachment icon filter roles2.zip 438.01 kb, 70 downloads since 2023-12-20 

Re: Hide a row or a specific record in frmdbCoreUserForm

Hi,

Thank you so much Derek for taking the time despite your busy schedule to explain something that is simple to most of advanced developers but still is a work in progress for most of us. It works great, basic is the best!!

I have read many articles about this solution in other forums but they were all context specific with no clear explanation  and I could not understand how to apply it to My Visual Database since I am not (yet) a Delphi programmer. I bought some Delphi books but I just started them...

Re: Hide a row or a specific record in frmdbCoreUserForm

Hi,
Glad it helped.
To summarise, the problem in this case is that you can't access any of the 'frmdbcorexxxxx' forms directly and so can't attach a procedure in the usual way. 
So instead, you use the  'onactivate' command which you associate with a specific form being opened (in this example 'frmdbcoreuserform')  and then call your own procedure ('@filterrole' in this example) that then contains the code to filter your combobox.
Just a word of caution - MVD script language uses only a sub-set of Delphi commands which means you can sometimes find something in a manual which works okay in Delphi but which hasn't been included in MVD (which can be pretty frustrating). 
But there is almost always an alternative solution in MVD if you try and approach things from a different angle.
Regards,
Derek..