Notify bug ?

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

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 »

Yep. Also, it is related with MsgInfo() also. If we don't use MsgInfo(), it works fine.
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 »

I tried to isolate MsgInfo() and the following code is still wrong:

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 := { || msgOther() }

  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




static function msgOther()

 local oMB := QMessageBox()

 oMB:setText( 'Notify Icon Clicked!' )
 oMB:exec()

RETURN nil
Seems to be related with the way QMessageBox() is executed or how it is anchored to the parent window.
Need a deeper analysis in QT itself...
[[]] Mauricio Ventura Faria
User avatar
concentra
Posts: 256
Joined: Fri Nov 26, 2010 11:31 am
Location: Piracicaba - Brasil

Re: Notify bug ?

Post by concentra »

Very ugly workaround ! :(

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 := { || msgOther(oWindow) }

  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




static function msgOther(oWindow)

 local oMB := QMessageBox()

 oMB:setText( 'Notify Icon Clicked!' )
 oMB:exec()
 if ! oWindow:Visible
    oWindow:show()
    oWindow:hide()
 endif

RETURN nil
[[]] Mauricio Ventura Faria
User avatar
concentra
Posts: 256
Joined: Fri Nov 26, 2010 11:31 am
Location: Piracicaba - Brasil

Re: Notify bug ?

Post by concentra »

I found...
It´s the QuitOnLastWindowClosed property.

Code: Select all

 if ! oWindow:Visible
    oWindow:s_qApp:setQuitOnLastWindowClosed(.F.)
 endif

 oMB:exec()

 if ! oWindow:Visible
    oWindow:s_qApp:setQuitOnLastWindowClosed(.T.)
 endif
[[]] 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 »

That's great!

Let us incorporate in the code.
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 »

I tried to change msgbox.prg but found no way to reference the main window.
And it's possible that msgbox.prg isn´t the only affected program... :(
[[]] 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 »

IMHO, it shall be put at hide()/show() method of window.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
Post Reply