Topic: You cannot change the TabOrder in two controls

Hello everyone and thanks for your interest in my problem.
In the attached project, in the "Start" form, in the "Caselle di posta" Tab there are two editboxes: "edNomecasellaposta" and "edCognomecasellaposta".
I can't change the tab order in any way for these two editboxes. In the attachment I have also included a screen shot to help those who don't speak Italian better understand it.
Thanks to all and greetings.

Post's attachments

Attachment icon Decora.zip 656.56 kb, 84 downloads since 2023-06-08 

Re: You cannot change the TabOrder in two controls

Ciao Fabio,
The reason is because GroupBox1 IS NOT the parent of 'edindirizzocasella' nor 'butcercacasella' whereas Groupbox1 IS the parent of 'ednomecasellaposta' and 'edcognomecasellaposta'. 
It is this difference that is causing the tab order problem (objects within a 'parent' object (ie a panel or a groupbox) have their own discrete tab order which is not part of the general tab order of the overall form.
The solution is to
1.  drag 'edindirizzocasella' and 'butcercacasella' off GroupBox1
2.  cut them
3.  paste them (but make sure you paste them WITHIN GroupBox1.
Then you should be able to set the tab order as normal.
See the attachment.
Derek.

Post's attachments

Attachment icon Decora fixed.zip 681.32 kb, 76 downloads since 2023-06-09 

3 (edited by reteinformatica 2023-06-09 08:32:11)

Re: You cannot change the TabOrder in two controls

Hi Derek,
As always, thank you very much for the intervention and the always decisive explanations.
Could you please tell me how to understand if a control is parent of a groupbox or a panel?

Also one more thing kindly derek: I made a change to the project to use an external .pas file for user management window translations.
When starting the program I get an error (expected ;). I think the problem is on the external file "Utenti.pas" but despite several changes I tried to make I could not correct the problem.
Thank you.

Post's attachments

Attachment icon Decora fixed2.zip 657.42 kb, 79 downloads since 2023-06-09 

Re: You cannot change the TabOrder in two controls

Hi Fabio, hi Derek


Fabio,

Each *.pas script file must have the structure:

var (if needed)

procedure ...;
var (if needed)
begin

end;
...
...
begin

end.

If the structure is broken you will get an error, as in your case.
Check the Utenti.pas file.

5 (edited by reteinformatica 2023-06-09 10:22:25)

Re: You cannot change the TabOrder in two controls

Hi sparrow,
thank you very much for describing the structure to me. I edited the file successfully. Really thank you very much.

6 (edited by reteinformatica 2023-06-09 10:23:03)

Re: You cannot change the TabOrder in two controls

Hi derek and sparrow,
I'm here again. I added more .pas files for tablegrid (tableg.pas) and Photo in DB (dbphoto.pas) translations.
I seem to have done everything right, there are no startup errors but all tablegrids and the Photo control in DB which is in the form 'frmDipendenti' are not translated and I really can't understand why.

Post's attachments

Attachment icon Decora fixed3.zip 666.77 kb, 82 downloads since 2023-06-09 

Re: You cannot change the TabOrder in two controls

Hi Fabio,

Could you please tell me how to understand if a control is parent of a groupbox or a panel?

To keep it simple (and just confined to MVD), you realistically only need to consider panels and groupboxes as 'parent' objects that other objects can be placed inside.
It's easier to explain with 2 diagrams (see the attachment).
In Screenshot1, there is a panel with 2 edit boxes and 2 buttons;  the edit boxes and the buttons both look the same.
But move them all to the right of the panel and see what happens (Screenshot2).
This shows that when I was designing the form, 'edit1 and 'button1' were created OUTSIDE of 'panel1' and then moved ON TOP of 'panel1' which means they can also can be moved off;  in this case, 'panel1' is not a parent because 'edit1 and 'button1' exist OUTSIDE of 'panel1'.
But 'edit2' and 'button2' were created INSIDE 'panel1' so when they are moved off, they start to disappear - a very obvious sign that 'panel1' is their parent;  they DO NOT exist outside of 'panel1'.
The whole point of using a panel or a groupbox as a 'parent' is that all of the objects that you create INSIDE of the 'parent' are controlled by the parent - for example, if you have 10 objects inside a panel, you can make them all invisible with just 1 instruction (form1.panel1.visible := false;).  If you have 10 objects that are NOT inside a panel (ie have no 'parent') then you need to write 10 separate instructions to make each individual one invisible.
I hope that clarifies rather than confuses!  smile
Derek.

Post's attachments

Attachment icon fg panels.zip 59.83 kb, 74 downloads since 2023-06-09 

8 (edited by sparrow 2023-06-09 13:21:19)

Re: You cannot change the TabOrder in two controls

It's good that you created procedure dbphoto; with message translation.
But unfortunately it will not be executed by itself (((.
Probably it needs to be called somewhere, for example,
in the OnShow event of the frmDipendenti form. Try it.

procedure frmDipendenti_OnShow (Sender: TObject; Action: string);
begin
    dbphoto;
    if action = 'NewRecord' then nuovo := 'new';
end;


May I ask what language does Windows speak to you?

The translation of drop-down menus of tables depends on this. Otherwise, you will have errors.

9 (edited by sparrow 2023-06-09 13:46:36)

Re: You cannot change the TabOrder in two controls

If you or a user on another computer speaks Windows other than English,
then such a syntax for translation will cause an error.
So wrong:

  start.grdIppubblici.dbpopupmenu.items.find('Show Record').caption := 'Apri';
  start.grdIppubblici.dbpopupmenu.items.find('Copy Cell').caption := 'Copia cella';
  start.grdIppubblici.dbpopupmenu.items.find('Copy Row').caption := 'Copia riga';
  start.grdIppubblici.dbpopupmenu.items.find('Copy All').caption := 'Copia tutto';
  start.grdIppubblici.dbpopupmenu.items.find('Find').caption := 'Cerca';
  start.grdIppubblici.dbpopupmenu.items.find('Delete Record').caption := 'Elimina Record';

And this is correct:

  start.grdIppubblici.dbpopupmenu.Items[0].caption := 'Apri';
  start.grdIppubblici.dbpopupmenu.Items[3].caption := 'Copia cella';
  start.grdIppubblici.dbpopupmenu.Items[4].caption := 'Copia riga';
  start.grdIppubblici.dbpopupmenu.Items[5].caption := 'Copia tutto';
  start.grdIppubblici.dbpopupmenu.Items[7].caption := 'Cerca';
  start.grdIppubblici.dbpopupmenu.Items[1].caption := 'Elimina Record';

Here is your correct table file.
For the photo, I showed in the previous post and replace the file for the tables. Nothing more needs to be done.

Post's attachments

Attachment icon tableg.pas 7.03 kb, 73 downloads since 2023-06-09 

Re: You cannot change the TabOrder in two controls

Hi derek,
thanks for the clarifications and also for, let's call them, tricks like hiding all the controls by simply placing them in a panel.
Hi sparrows,
Windows is in Italian. I'm getting a little confused trying to figure out what's going on. For example, in the project I am attaching, I created a file to translate messages in tablegrids in the same way and, as you can see, without using £procedure" yet the translation works.

Post's attachments

Attachment icon Laboratorio.zip 406.28 kb, 76 downloads since 2023-06-09 

Re: You cannot change the TabOrder in two controls

Hi sparrow,
I don't get this error.

Re: You cannot change the TabOrder in two controls

Hi Fabio,
Attached is a 'real life' example of putting objects on a panel.
Just move the cursor to the bottom of the form and all the objects belonging to the 'parent' panel are revealed or hidden - but it only takes one line of code which is the whole point.
Derek.

Post's attachments

Attachment icon fabio example.zip 437.41 kb, 77 downloads since 2023-06-09 

13 (edited by reteinformatica 2023-06-09 18:39:08)

Re: You cannot change the TabOrder in two controls

Thanks derek, the menu that appears on hover is very very beautiful!
Can you also give me an explanation why I can't translate the tablegrid and the image in db?

14 (edited by reteinformatica 2023-06-09 18:43:24)

Re: You cannot change the TabOrder in two controls

sparrow wrote:

I should have warned you and you decide.

Here is your project with an error on my computer in which the language is not English.

Hi sparrow,
as you can see even if you don't start the "Laboratorio" program, in the "tableg.pas" file there is no "procedure" instruction and yet when you start it there is no problem and the TableGrids are translated regularly. I don't understand why in the other project they are not translated.

Re: You cannot change the TabOrder in two controls

Just compare the tableg.pas file from this project and the "Laboratorio" project.
Translation strings must be in a section



begin

end.

16 (edited by reteinformatica 2023-06-09 19:18:22)

Re: You cannot change the TabOrder in two controls

In this case, if I put the code between "Begin" and "End." it gives me the same error you get when starting up. Then the program starts anyway and the some tablegrid not all are translated but at every start it opens that error window. Up to the "Caselle di posta" tab are translated, the following ones are not.
I checked and double checked and the identifiers should be right, then with all this code I might as well have gotten lost and wrong.

Re: You cannot change the TabOrder in two controls

In my post above, I gave you the finished file, overwrite instead of your file.

http://myvisualdatabase.com/forum/viewt … 913#p47913

Re: You cannot change the TabOrder in two controls

Here is your project

Post's attachments

Attachment icon Decora fixed4.zip 675.37 kb, 79 downloads since 2023-06-09 

Re: You cannot change the TabOrder in two controls

Sorry sparrow and thanks for all the time you wasted writing that file. I hadn't noticed your attachment and now that I've seen and tried it I see that it works perfectly.
Only that I'm a curious guy and I have to figure out where I'm wrong, I hardly give up. I am always very grateful that you waste time, even a lot, making corrections but I would also like to understand them.
With my file, in addition to the startup error, half the tablegrids are translated and half are not and this is totally confusing me. Then in the other project it works and in this one it doesn't, total confusion.

Re: You cannot change the TabOrder in two controls

Fabio, it's all right

21 (edited by reteinformatica 2023-06-11 17:10:27)

Re: You cannot change the TabOrder in two controls

Hi sparrow, of course everything is ok, in the end the result is achieved, but I will always have the doubt as to why pieces of code work in certain situations and not in others.
Also the photo control in DB, in another project I translated it without problems and in this one it does as it wants.
Thanks anyway because you always help me too.

22 (edited by reteinformatica 2023-06-11 18:06:00)

Re: You cannot change the TabOrder in two controls

I also made this other discovery.
If I put the word è in MVD "script" the word is written correctly, if I do, let's say, take it from the .pas file the word instead becomes a strange A that I can't find in the character map, while the word "Sì" becomes "Sì"