Windows tray popup/message (Ballon notfication)

Posted by OctavioOlguin on 10-Mar-2017 12:03

I would like to inform via popup bubble (Ballon notification) on windows client that a query on remote appserver is done...

Is there a way to send those notifications that has being proofed on ABL?

Thanks!

Posted by Jeff Ledbetter on 10-Mar-2017 15:06

Here is an older example I had in my samples directory.. still seems to work...

USING System.ComponentModel.*.
USING System.Windows.Forms.*.

DEFINE VARIABLE c AS CHARACTER FORMAT "x(30)" LABEL "Enter tip".

DEFINE VARIABLE components AS CLASS Container.
DEFINE VARIABLE notifyIcon AS CLASS NotifyIcon.

RUN setupNotifyIcon.

DO WHILE TRUE ON END-KEY UNDO, LEAVE:
  UPDATE c WITH FRAME A VIEW-AS DIALOG-BOX THREE-D SIDE-LABELS TITLE "The Tip Maker".
  RUN showTip ("Just the tip", c, 50).
END.

QUIT.

FINALLY:
  DELETE OBJECT components.
  DELETE OBJECT notifyIcon.
END FINALLY.

PROCEDURE setupNotifyIcon:

  DEFINE VARIABLE cIconFilename AS CHARACTER NO-UNDO.
   
  cIconFilename = SEARCH("d:\work\rtb\rtbgears.ico"). 
  
  components = NEW System.ComponentModel.Container(). 
  
  notifyIcon = NEW System.Windows.Forms.NotifyIcon(components).
  notifyIcon:Text = "Roundtable TSMS".
  notifyIcon:Icon = NEW System.Drawing.Icon (cIconFilename).
  notifyIcon:Visible = TRUE.
    
END PROCEDURE.

PROCEDURE showTip:

  DEFINE INPUT  PARAMETER pcTitle  AS CHARACTER NO-UNDO.
  DEFINE INPUT  PARAMETER pcText   AS CHARACTER NO-UNDO.
  DEFINE INPUT  PARAMETER piTime   AS INTEGER   NO-UNDO. 

  notifyIcon:BalloonTipTitle = pcTitle. 
  notifyIcon:BalloonTipText = pcText.
  notifyIcon:ShowBalloonTip(piTime).

  RETURN.

END PROCEDURE.


All Replies

Posted by Mike Fechner on 10-Mar-2017 13:27
Posted by OctavioOlguin on 10-Mar-2017 14:36

Thanks.. Just s little question.

I got struck on the ....... part of the sintaxis...  Docs say that there should be a ToolTipIcon.Info  datatype

this is where i get to:

    DEFINE VARIABLE notifyIcon1 AS NotifyIcon.
    DEFINE VARIABLE ToolTipIcon1 AS ToolTipIcon.

    notifyIcon1:VISIBLE = YES.
    notifyIcon1:ShowBalloonTip(20000, "Information", "This is the text",
        ToolTipIcon1....... ).

How could I get that value on ABL?

TIA 

Posted by Jeff Ledbetter on 10-Mar-2017 15:06

Here is an older example I had in my samples directory.. still seems to work...

USING System.ComponentModel.*.
USING System.Windows.Forms.*.

DEFINE VARIABLE c AS CHARACTER FORMAT "x(30)" LABEL "Enter tip".

DEFINE VARIABLE components AS CLASS Container.
DEFINE VARIABLE notifyIcon AS CLASS NotifyIcon.

RUN setupNotifyIcon.

DO WHILE TRUE ON END-KEY UNDO, LEAVE:
  UPDATE c WITH FRAME A VIEW-AS DIALOG-BOX THREE-D SIDE-LABELS TITLE "The Tip Maker".
  RUN showTip ("Just the tip", c, 50).
END.

QUIT.

FINALLY:
  DELETE OBJECT components.
  DELETE OBJECT notifyIcon.
END FINALLY.

PROCEDURE setupNotifyIcon:

  DEFINE VARIABLE cIconFilename AS CHARACTER NO-UNDO.
   
  cIconFilename = SEARCH("d:\work\rtb\rtbgears.ico"). 
  
  components = NEW System.ComponentModel.Container(). 
  
  notifyIcon = NEW System.Windows.Forms.NotifyIcon(components).
  notifyIcon:Text = "Roundtable TSMS".
  notifyIcon:Icon = NEW System.Drawing.Icon (cIconFilename).
  notifyIcon:Visible = TRUE.
    
END PROCEDURE.

PROCEDURE showTip:

  DEFINE INPUT  PARAMETER pcTitle  AS CHARACTER NO-UNDO.
  DEFINE INPUT  PARAMETER pcText   AS CHARACTER NO-UNDO.
  DEFINE INPUT  PARAMETER piTime   AS INTEGER   NO-UNDO. 

  notifyIcon:BalloonTipTitle = pcTitle. 
  notifyIcon:BalloonTipText = pcText.
  notifyIcon:ShowBalloonTip(piTime).

  RETURN.

END PROCEDURE.


Posted by OctavioOlguin on 10-Mar-2017 16:03

Thanks Mike and Jeff!!!

Posted by OctavioOlguin on 11-Mar-2017 18:29

One last question.....

I used jeff's code (credits listed on code) ;)

but I found that the ballons are not very reliable, as while testing, I ended with 30 or so little icons on the notification area (next to clock) and were stacked somehow, then as I cleared some (click on it) and so they showed the message popup.  Still, there are 7 notifications pending, but I can't clear them.  And new notification won't throw ballon...

Any clue?

Posted by OctavioOlguin on 11-Mar-2017 18:36

This is the code:

 /*------------------------------------------------------------------------
    File        : NotifyToolTip
    Purpose     :
    Syntax

        USING procs.msg.NotifyToolTip FROM PROPATH.
        DEFINE VARIABLE Ballon        AS NotifyToolTip         NO-UNDO.
        Ballon = NEW NotifyToolTip ().
        ballon:ShowTip("Título", "Mensaje", 10).

    Description : Genera una Notificación tipo  Ballon Tool Tip en windows.
    Author(s)   : JorgeOctavioOlguin
    Created     : Fri Mar 10 15:53:44 CST 2017
    Notes       : Orignal   Jeff Ledbetter  Tugboat Software..
  ----------------------------------------------------------------------*/

USING Progress.Lang.*.
USING System.ComponentModel.*.
USING System.Windows.Forms.*.

BLOCK-LEVEL ON ERROR UNDO, THROW.


CLASS Procs.Msg.NotifyToolTip:
DEFINE VARIABLE components AS CLASS Container. DEFINE VARIABLE notifyIcon AS CLASS NotifyIcon. CONSTRUCTOR PUBLIC NotifyToolTip ( ): SUPER (). DEFINE VARIABLE cIconFilename AS CHARACTER NO-UNDO. cIconFilename = SEARCH("Procs\iconos\sch.ico"). components = NEW System.ComponentModel.Container(). notifyIcon = NEW System.Windows.Forms.NotifyIcon(components). notifyIcon:Text = "Sistema TAP". notifyIcon:Icon = NEW System.Drawing.Icon (cIconFilename). notifyIcon:Visible = TRUE. END CONSTRUCTOR. METHOD PUBLIC VOID ShowTip( INPUT pcTitle AS CHARACTER, INPUT pcText AS CHARACTER, INPUT piTime AS INTEGER ): notifyIcon:BalloonTipTitle = pcTitle. notifyIcon:BalloonTipText = pcText. notifyIcon:ShowBalloonTip(piTime). RETURN. END METHOD. DESTRUCTOR PUBLIC NotifyToolTip ( ): DELETE OBJECT components. DELETE OBJECT notifyIcon. END DESTRUCTOR. END CLASS.

Posted by OctavioOlguin on 11-Mar-2017 18:37

What if we move the notifyIcon:Visible = TRUE.

to the ShowTip()?

Just thinking aloud.

This thread is closed