Forum > LCL

Get WindowState Info/Ablak állapotának lekérdezése (Multilang)

(1/2) > >>

TheProgrammer:
if WindowState = wsMaximized then
   begin
   IniFile.WriteString('default', 'maximized', 'True')
   end
else
    begin
    IniFile.WriteString('default', 'maximized', 'False')
    end;

How can i get Windows State info?
Hogyan tudom lekérdezni az ablak állapotát?   

felipemdc:
You already posted code which does what you want, so I don't understand your question.

TheProgrammer:
This code does not work.
Ez a kód nem működik.

Maximized windows, INI file:
Maximalizált ablak, INI fájl:
[default]
maximized=False

TheProgrammer:
Already found a problem and was not there. Sorry!
Már megtaláltam a hibát és nem ott volt. Bocs!

Blaazen:
This is snippet from my project:

--- Code: ---var helpBool: Boolean;
.....
  with screenIniFile do
        begin
          try
            iniSection:='MainWindow';
            helpBool:=(WindowState=wsMaximized);
            WriteBool(iniSection, 'wsMaximized', helpBool);
            if helpBool=False then
              begin
                WriteInteger(iniSection, 'Left', Left);
                WriteInteger(iniSection, 'Top', Top);
                WriteInteger(iniSection, 'Width', Width);
                WriteInteger(iniSection, 'Height', Height);
              end;                                             

--- End code ---
as you can see, it saves window state and coordinates and size.

Opposite function:

--- Code: ---var wsMaxi: Boolean;
....
wsMaxi:=ReadBool(iniSection, 'wsMaximized', True);

--- End code ---

This is working piece of code, but consider this:
WindowState was extended, now it has new state: wsFullScreen. Becaue WindowState is enumeration, if I would write this code again, I would read and write this parameter as Integer (retyped enumeration) rather than Boolean.

Navigation

[0] Message Index

[#] Next page

Go to full version