Notify bug ?

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
concentra
Posts: 256
Joined: Fri Nov 26, 2010 11:31 am
Location: Piracicaba - Brasil

Notify bug ?

Post by concentra »

Hi all

I need an application that runs without a visible window and I am trying to use the notify options in the window class.
But it did not work as I expect...
If the main window is visible everything goes Ok.
But the application closes itself when the main window is hidden.
See this sample code:

Code: Select all

#include "hbqtgui.ch"
#include "hmg.ch"

Function Main
public oWindow

 With Object oWindow := Window():New()
  :Width  := 400
  :Height  := 400
  :Title  := 'Hide bug...'
  :Type  := WND_MAIN
  :NotifyIcon := 'Hide bug...'
  :NotifyToolTip := 'Hi All!'
  :OnNotifyClick := { || msginfo('Notify Icon Clicked!') }

  With Object oNotify := NotifyMenu():New(oWindow)
   oItemHide  := MenuItem():New( 'Hide Main Window'  , { || oWindow:Hide() } ) ; :AddItem(oItemHide)
   :AddSeparator()
   oItemShow  := MenuItem():New( 'Show Main Window'  , { || oWindow:Show() } ) ; :AddItem(oItemShow)
  End With

 End With

 oWindow:Activate()

Return Nil
If I open the notify menu in the tray bar and click Hide Main Window the main window goes invisible as expected.
But if I left-click the icon in the tray, executing the :OnNotifyClick block, the block is executed and after that the application simply closes...

I tried to review the code but was unable to identify why is this happening.
[[]] Mauricio Ventura Faria
User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Notify bug ?

Post by Rathinagiri »

Hi,

Just add this line after function main()

hbqt_errorsys()

It is temporary and once testing is over, we will change this to call errorsys.

Regards,

S. Rathinagiri.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
concentra
Posts: 256
Joined: Fri Nov 26, 2010 11:31 am
Location: Piracicaba - Brasil

Re: Notify bug ?

Post by concentra »

Hi Rathinagiri.
rathinagiri wrote: hbqt_errorsys()
Nothing different, no error, no message, nothing, the application just closes...
[[]] Mauricio Ventura Faria
User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Notify bug ?

Post by Rathinagiri »

Nope. It is working for me.

Which version you are using?
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

Re: Notify bug ?

Post by l3whmg »

Hi Concentra,
I check you source and work fine for me with or without HBQT_ERRORSYS() but i suggest to you: use it.

Best regards.
Luigi from Italy
www.L3W.it
User avatar
concentra
Posts: 256
Joined: Fri Nov 26, 2010 11:31 am
Location: Piracicaba - Brasil

Re: Notify bug ?

Post by concentra »

SVN.
Just to take sure, I updated SVN and tried again and the problem persists.
I added hbqt_errorsys() as you suggested and corrected the PNG icon reference.

Code: Select all

#include "hbqtgui.ch"
#include "hmg.ch"

Function Main

 hbqt_errorsys()

 public oWindow

 With Object oWindow := Window():New()
  :Width  := 400
  :Height  := 400
  :Title  := 'Hide bug...'
  :Type  := WND_MAIN
  :NotifyIcon := 'new.png'
  :NotifyToolTip := 'Hi All!'
  :OnNotifyClick := { || msginfo('Notify Icon Clicked!') }

  With Object oNotify := NotifyMenu():New(oWindow)
   oItemHide  := MenuItem():New( 'Hide Main Window'  , { || oWindow:Hide() } ) ; :AddItem(oItemHide)
   :AddSeparator()
   oItemShow  := MenuItem():New( 'Show Main Window'  , { || oWindow:Show() } ) ; :AddItem(oItemShow)
  End With

 End With

 oWindow:Activate()

Return Nil
In order to see the problem in the sample:

-Start the application
-Left-click in the tray icon. A message 'Notify Icon Clicked!' is displayed. This is Ok.
-Close the msginfo box. This is Ok.
-Right-click the tray icon and select 'Hide Main Window'. The main window is hidden. This is Ok.
-Left-click in the tray icon. A message 'Notify Icon Clicked!' is displayed. This is Ok.
-Close the msginfo box. === > The application closes. This is NOT ok.
[[]] Mauricio Ventura Faria
User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Notify bug ?

Post by Rathinagiri »

I will do asper your direction and check it.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
concentra
Posts: 256
Joined: Fri Nov 26, 2010 11:31 am
Location: Piracicaba - Brasil

Re: Notify bug ?

Post by concentra »

Hi Rathinagiri.

Had you take a look in this ?
[[]] Mauricio Ventura Faria
User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Notify bug ?

Post by Rathinagiri »

Yes, I do confirm the problem, and could not find out a solution.

It seems correct.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
Carlos Britos
Posts: 245
Joined: Sat Aug 02, 2008 5:03 pm

Re: Notify bug ?

Post by Carlos Britos »

Apparently there is no harbour error, testing this code, the program continue running. But no idea about what's happening, but hide command seem to be involved on this.

Code: Select all

#include "hbqtgui.ch"
#include "hmg.ch"

Function Main

// hbqt_errorsys()

public oWindow

With Object oWindow := Window():New()
  :Width  := 400
  :Height  := 400
  :Title  := 'Hide bug...'
  :Type  := WND_MAIN
  :NotifyIcon := 'save.png'
  :NotifyToolTip := 'Hi All!'
  :OnNotifyClick := { || msginfo('Notify Icon Clicked!'), oWindow:Show() }

  With Object oNotify := NotifyMenu():New(oWindow)
   oItemHide  := MenuItem():New( 'Hide Main Window'  , { || oWindow:Hide() } ) ; :AddItem(oItemHide)
   :AddSeparator()
   oItemShow  := MenuItem():New( 'Show Main Window'  , { || oWindow:Show() } ) ; :AddItem(oItemShow)
  End With

End With

oWindow:Activate()
Return Nil
Regards/Saludos, Carlos (bcd12a)
Post Reply