Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-04

main form icon and other things

20 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Alberto Narduzzi

Hi all,

I am pretty new to this list, althou I used Lazarus and fpc a lot in the past; and now I am back to it.

I recently updated both Lazarus and the fpc compiler to the following versions:

Lazarus: 0.9.28.2 beta SVN Revision: 22288
fpc: Free Pascal Compiler version 2.2.4 [2009/10/05] for i386

(cannot tell you what versions I had before, but I think they were those coming with a Fedora 7 bundle)

Anyway, here are my "problems":

1. I specify (load, from the object inspector) an icon for the application's main form, but when I compile and run the application, its icon is always the red "X" icon; no matter what file I load (be it an .ico, or an .xpm). Nothing changes even if I dynamically load it at runtime, in the form's oncreate handler (in this case I can load only an .ico).
This thing worked in the previous versions, althou' the correct icon's transparency was obtainable only using an .xpm.

2. I used to start my program minimized in the application's bar (not the tray area) by specifying WindowState := wsMinimized in the oncreate handler, and it all worked; but now this doesn't.
To solve the thing I can do a Application.Minimize in the onshow handler, but this causes an annoying flicker (the form is shown in its normal state for a fraction of a second, then minimizes).

Dows anybody know a solution, or a trick to get these two things to work as before? apart from trying to reinstall the old versions of compiler and ide, of course ;-)

Thanks in advance,
A.

AN
ANSware Ltd - Sofia

Reply by email

shoKwave
to Alberto Narduzzi
Alberto Narduzzi wrote 15 lines
1. I specify (load, from the object inspector) an icon for the application's main form, but when I compile and run the application, its icon is always the red "X" icon; no matter what file I load (be it an .ico, or an .xpm). Nothing changes even if I dynamically load it at runtime, in the form's oncreate handler (in this case I can load only an .ico). This thing worked in the previous versions, althou' the correct icon's transparency was obtainable only using an .xpm. 2. I used to start my program minimized in the application's bar (not the tray area) by specifying WindowState := wsMinimized in the oncreate handler, and it all worked; but now this doesn't. To solve the thing I can do a Application.Minimize in the onshow handler, but this causes an annoying flicker (the form is shown in its normal state for a fraction of a second, then minimizes).

Hi,

1. Have you seen the possibility to set an icon in project/projectoptions menu?
2. I use Form1.Hide in onShow event and can't see any flicker. Maybe my mashine is to fast?

Hope it helps.

Ingo

Reply by email

Alberto Narduzzi
to shoKwave

shoKwave,

1. Have you seen the possibility to set an icon in project/projectoptions menu?

I'm under Linux, no option to set an icon in project/project options...

2. I use Form1.Hide in onShow event and can't see any flicker. Maybe my mashine is to fast?

if I do so (quite obviously) I don't see the form (in the onshow, when it needs to show up, you hide it again); moreover, this way I cannot see the application button in the taskbar.

Any other clues?

Thanks anyway, A.

Reply by email

Paul Ishenin
to Alberto Narduzzi: I am pretty new to this list, althou I used Lazarus and fpc a lot in the past; and now I…
Alberto Narduzzi wrote 9 lines
1. I specify (load, from the object inspector) an icon for the application's main form, but when I compile and run the application, its icon is always the red "X" icon; no matter what file I load (be it an .ico, or an .xpm). Nothing changes even if I dynamically load it at runtime, in the form's oncreate handler (in this case I can load only an .ico). This thing worked in the previous versions, althou' the correct icon's transparency was obtainable only using an .xpm.

There was much changed regards icon support for 0.9.28 But as I remember icons worked. Maybe paticular images does not work properly. Please create a bug report with a test application and we will see what is wrong there.

Best regards,
Paul Ishenin.

Reply by email

Alberto Narduzzi
to Paul Ishenin

Paul,

(...)Maybe paticular images does not work properly. Please create a bug report with a test application and we will see what is wrong there.

ok, so I created a brand new project, and the icon worked. So must be something with my project having been created with a previous version of Lazarus.

Now I'll investigate in the lfm etc. to see if I can get somewhere.

Thank you,
A.

Reply by email

Alberto Narduzzi
to Paul Ishenin: There was much changed regards icon support for 0.9.28 But as I remember icons worked.…

Dear all,

ok, as sometimes, only talking about something is enough to get it solved... I saw I was suing bsDialog as the style of my main form, and that prevented the icon to show. Setting it to either bsSingle, or bsSizeable solved the issue.

Now I have only to check if also the windowstate was affected by such setting.

Sorry, I should have checked this before, but since it worked, I never thought of any changes in the behavior of the forms; this must be something related to improvements/changes in the LCL, ain't it?

Cheers, A.

Reply by email

Paul Ishenin
to Alberto Narduzzi
Alberto Narduzzi wrote 13 lines
Dear all, ok, as sometimes, only talking about something is enough to get it solved... I saw I was suing bsDialog as the style of my main form, and that prevented the icon to show. Setting it to either bsSingle, or bsSizeable solved the issue. Now I have only to check if also the windowstate was affected by such setting. Sorry, I should have checked this before, but since it worked, I never thought of any changes in the behavior of the forms; this must be something related to improvements/changes in the LCL, ain't it?

Forms with bsDialog style does not have icon. This is so in delphi too. They also can't be resized but in gtk2 they can (and this will be fixed sooner or later).

Best regards,
Paul Ishenin.

Reply by email

Alberto Narduzzi
to Paul Ishenin

Paul,

Forms with bsDialog style does not have icon. This is so in delphi too.

this is true (well, I take it as you say it), but what I was pointing out is that with the previous versions it indeed had the icon, so I didn't dig the thing and focused only on some strange (more correct?) behavior.

They also can't be resized but in gtk2 they can (and this will be fixed sooner or later).

yes, I saw it, and fixed everything with a procedure that loops in all the forma of the application, and when it encounters a bsDialog changes it back to bsSingle and sets the constraints to have it non-resizeable, and removes the border icons; it's just 7 lines of code, and I call it in the main project file before application.run.

It works, but once you'll fix the gtk2 behavior I'll just remove the call.

Cheers, A.

Reply by email

Alberto Narduzzi
to Paul Ishenin: Forms with bsDialog style does not have icon. This is so in delphi too. They also can't…

Ah, Paul,

one more thing, thinking about Delphi:

Forms with bsDialog style does not have icon. This is so in delphi too.

ok, but in my case the bsDialog form was the main one; and since there is no other way of having the application have an icon to show in the taskbar, I saw that specifying one for the main form did it (with older Lazarus).
Now, fixing the behavior for the bsDialog-ed forms removed also the icon the application receives.

Maybe an icon field in the project options should help.

Cheers, A.

Reply by email

Paul Ishenin
to Alberto Narduzzi
Alberto Narduzzi wrote 8 lines
ok, but in my case the bsDialog form was the main one; and since there is no other way of having the application have an icon to show in the taskbar, I saw that specifying one for the main form did it (with older Lazarus). Now, fixing the behavior for the bsDialog-ed forms removed also the icon the application receives. Maybe an icon field in the project options should help.

There are differences between widgetsets. On windows application is a separate window and the project icon is associated with it. On gtk2 taskbar icons are shown per form and icons are the same as forms have (btw, bsDialog should not have a taskbar icon but currently in gtk2 it has). On OSX forms can't have an icon and only application can have one
- it is shown on the dock.

Therefore if you are working with gtk2 and you have only bsDialog form then you should not see any icon on the taskbar.

Best regards,
Paul Ishenin.

Reply by email

Mattias Gaertner
to Paul Ishenin
Show quoted text 18 lines
02.04.2010 17:22, Alberto Narduzzi wrote: > ok, but in my case the bsDialog form was the main one; and since there > is no other way of having the application have an icon to show in the > taskbar, I saw that specifying one for the main form did it (with > older Lazarus). > Now, fixing the behavior for the bsDialog-ed forms removed also the > icon the application receives. > > Maybe an icon field in the project options should help. There are differences between widgetsets. On windows application is a separate window and the project icon is associated with it. On gtk2 taskbar icons are shown per form and icons are the same as forms have (btw, bsDialog should not have a taskbar icon but currently in gtk2 it has). On OSX forms can't have an icon and only application can have one - it is shown on the dock. Therefore if you are working with gtk2 and you have only bsDialog form then you should not see any icon on the taskbar.

That would be strange. Which other gtk2 application does not show an icon in the taskbar?

Mattias

Reply by email

Alberto Narduzzi
to Paul Ishenin: There are differences between widgetsets. On windows application is a separate window and…

Dear Paul,

Show quoted text 9 lines
There are differences between widgetsets. On windows application is a separate window and the project icon is associated with it. On gtk2 taskbar icons are shown per form and icons are the same as forms have (btw, bsDialog should not have a taskbar icon but currently in gtk2 it has). On OSX forms can't have an icon and only application can have one - it is shown on the dock. Therefore if you are working with gtk2 and you have only bsDialog form then you should not see any icon on the taskbar.

I'm not complaining at all, let's make it clear; I know some of all this stuff...
I was just stating that something has changed behavior between Lazarus versions, that's all.

And, moreover, I solved all the issues (ok, the one with the flickering still remains, but it's not a big thing).

Thanks for the talk ;-)
And Happy Easter to everybody who -somehow- celebrates it.

Cheers, A.

Reply by email

Mattias Gaertner
to Paul Ishenin
Show quoted text 5 lines
03.04.2010 2:45, Mattias Gaertner wrote: > That would be strange. Which other gtk2 application does not show an > icon in the taskbar? > I think those which consists of only 1 dialog form.

For example?

Mattias

Reply by email

Alberto Narduzzi
to Mattias Gaertner
For example?

1. create a new application
2. set it's main form BorderStyle to bsDialog
3. set up an icon for your form
4. compile and run

you should not see your icon as the application's one, the X-server one instead.

if you change the BorderStyle either to bsSingle or bsSizeable, and just recompile and run, then you can see your icon.

Cheers, A.

Reply by email

Mattias Gaertner
to Paul Ishenin
Show quoted text 5 lines
03.04.2010 9:08, Mattias Gaertner wrote: > For example? Usually applications have a regular main form, not a bsDialog one. So how I can invent you such an example. Maybe on windows - some trayicon applications.

I was asking for a real life example. I have never seen such a thing. IMHO bsDialog should show an icon under Linux.

Mattias

Reply by email

Paul Ishenin
to Mattias Gaertner
Mattias Gaertner wrote
I was asking for a real life example. I have never seen such a thing. IMHO bsDialog should show an icon under Linux.

Ah. You are asking about an example of a dialog form? This is not a problem. Find/Replace form or form which shows message (MessageDlg) are dialog forms. They should not have neither taskbar icon nor taskbar button and they must be not resizable.

Best regards,
Paul Ishenin.

Reply by email

Mattias Gaertner
to Paul Ishenin
Show quoted text 8 lines
03.04.2010 16:39, Mattias Gaertner wrote: > I was asking for a real life example. I have never seen such a thing. > IMHO bsDialog should show an icon under Linux. > Ah. You are asking about an example of a dialog form? This is not a problem. Find/Replace form or form which shows message (MessageDlg) are dialog forms. They should not have neither taskbar icon nor taskbar button and they must be not resizable.

Only dialogs with no sizable controls can be fixed size. So the splashscreen can be fixed size.
Even a message dialog can be too big for the screen and then it should be resizable.
The find/replace dialog is good example for a dialog that must be resizable, as the text can be long.
I'm always cursing the many non resizable dialogs in MS Windows. And I know that even windows lovers don't like that.

About the icon:
If a window is shown in the taskbar it should show an icon, otherwise they get a default one from the window manager.

A modal form does not need to be shown in the taskbar - if it is the only one. But the VCL allows to show one form modal and then one form normal. The last will be shown in the same layer as the modal one, so you need buttons to switch between them.

Mattias

Reply by email

Paul Ishenin
to Mattias Gaertner
Mattias Gaertner wrote 9 lines
Only dialogs with no sizable controls can be fixed size. So the splashscreen can be fixed size. Even a message dialog can be too big for the screen and then it should be resizable. The find/replace dialog is good example for a dialog that must be resizable, as the text can be long. I'm always cursing the many non resizable dialogs in MS Windows. And I know that even windows lovers don't like that.

If you don't like them then don't use bsDialog in your applications :) I know ubuntu applications which have dialog with the fixes size.

About the icon: If a window is shown in the taskbar it should show an icon, otherwise they get a default one from the window manager.

bsDialog needs to be shown without a taskbar item. If develop uses bsDialog for another tasks then it is a developer problem, not an LCL one.

Show quoted text 5 lines
A modal form does not need to be shown in the taskbar - if it is the only one. But the VCL allows to show one form modal and then one form normal. The last will be shown in the same layer as the modal one, so you need buttons to switch between them.

You are trying to care about poorly developed applications I think.

Best regards,
Paul Ishenin.

Reply by email