1 (edited by madbit71 2023-05-13 22:18:04)

Topic: Hide system menu after db path change

Hi everyone,
I moved the sqlite.db file to a different location on my hard drive.
When I start the application a message box allows me to select the new file path...but in the background form1 is visible.
If I cancel the message box (or leave it open and move it) I can operate the system menu despite having hidden it with a script.
Is there a way to make the menu, or any of its items, not appear in this specific case?
Thank you.

Post's attachments

Attachment icon menu_sistema_visibili.png 43.53 kb, 36 downloads since 2023-05-14 

Re: Hide system menu after db path change

Hi Madbit,
Instead of hiding the system menu using your script (mnifile.visible := false etc etc), try setting the form object property to 'BorderStyle = 'BsDialog' (see the attached screenshot).
Derek.

Post's attachments

Attachment icon screenshot.jpg 108.61 kb, 37 downloads since 2023-05-14 

Re: Hide system menu after db path change

Hi Derek, thanks for the reply.
I immediately tried your solution on a test project and it works great, but when I changed the 'bsdialog' property on my main operational project, it didn't work.
Experimenting I found that changing the 'bsdialog' property doesn't work, for this specific functionality of hiding the system menu, if the project has been styled.
In fact I'm using the 'glow' style and still see the menu despite changing that property.
The 'problem' only concerns a graphical aspect of my application, when the db is not found the message window appears and the scripts are not executed, therefore my form1 appears with a very messy layout and you see panels in positions where they should be... to avoid this unpleasant sensation of approximation to the user, I inserted a panel that completely covers form1 and, if the db is found and the application opens, I hide it with this command on form1 on show:
form1.pnlscreen .visible.=false;
otherwise it remains visible to completely cover form1.
The only flaw is that the system menu appears and I don't want the user to be able to see the structure of the db.
Could there be some other solution?
Can I disable the style somehow and, I don't know, re-enable it after entering the login credentials?
Thank you

Re: Hide system menu after db path change

Hi Madbit,
Sorry, I didn't realise you were using 'styles'.
I think 'styles' is a great tool but frustratingly there are a couple of areas where there are weaknesses and what you're trying to resolve seems like one of them.
Coincidently I was also looking at trying to disable 'styles' at certain points and then re-enabling it back to my preferred 'style setting' (CyanDusk) but didn't make any progress with it;  it would be pretty neat if that could be done and would resolve a number of issues.
Regards,
Derek.

Re: Hide system menu after db path change

Hi all


If you look closely, the process looks like this:
1. The program starts.
2. The existence of the database file is checked.
     Form Form1 is formed.
3. The base selection window is displayed.
At this point, the script is not being executed. Directives are not available for execution either.
The only possibility available is the one Derek wrote. But it doesn't work when the style is loaded.
Any commands written in the script are not yet available. Even checking the script for validity does not work.

What is your goal? Perhaps there are other ways?

Re: Hide system menu after db path change

Hi Derek and Sparrow,
thanks for your interest.
My goal is to hide the system menu when the database is not found.
The solution Derek proposed works great if the program doesn't use a style.
However, my program uses a style, and I would like to continue to maintain it.
I attach a small project file with an image.

Sorry Derek I didn't specify that I used a style.

Post's attachments

Attachment icon nascondino.rar 613.35 kb, 121 downloads since 2023-05-14 

7 (edited by jrga 2023-10-04 11:34:32)

Re: Hide system menu after db path change

procedure frmLogin_chk_menu_OnClick (Sender: TObject);
//*** Proc 834 - menu invisível do sistema é tornado vísivel pelo usuário
begin
   if frmLogin.BorderStyle = bsDialog then
      frmLogin.BorderStyle := bsSingle
   else frmLogin.BorderStyle := bsDialog;
end;

*** work

Roberto Alencar