rejetto forum
May 25, 2012, 07:48:45 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: This forum is free, you do NOT need to register to post. But you may.
PROBLEMS? QUESTIONS? CLICK HERE!
Fill the survey!
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: tray.balloon  (Read 1085 times)
0 Members and 1 Guest are viewing this topic.
Mars
Operator
Insane poster
*****
Offline Offline

France France

Posts: 1481



View Profile WWW
« on: September 14, 2010, 09:21:08 AM »

@rejetto

with a little update , it's posible to use the NOTIFY MESSAGE not only with the macro notify

With a small update, it is possible to use the NOTIFY messages except the notify macro

Quote
SCRIPTLIB.PAS

    if name = 'notify' then
      begin
      tray.balloon(p, par('type'), par('title'), parF('timeout',3));
      result:='';
      end;

Quote
TRAYLIB.PAS

      function  balloon(msg:string; MessageType:string=''; title:string=''; secondsTimeout:real=3):boolean; OVERLOAD;
      function  balloon(msg:string; secondsTimeout:real):boolean; OVERLOAD;

.........

function TmyTrayIcon.balloon(msg:string; MessageType:string; title:string; secondsTimeout:real):boolean;
  var kind:TtrayMessageType;
  function stringTotrayMessageType(s:string):TtrayMessageType;
    begin
    if compareText(s,'warning') = 0 then
      result:=TM_WARNING
    else if compareText(s,'error') = 0 then
      result:=TM_ERROR
    else if compareText(s,'info') = 0 then
      result:=TM_INFO
    else
      result:=TM_NONE
    end; // stringTotrayMessageType


begin
kind:=stringTotrayMessageType(MessageType);
case kind of
  TM_WARNING: icondata.dwInfoFlags:=NIIF_WARNING;
  TM_ERROR: icondata.dwInfoFlags:=NIIF_ERROR;
  TM_INFO: icondata.dwInfoFlags:=NIIF_INFO;
  else icondata.dwInfoFlags:=NIIF_NONE;
end;
strPLCopy(icondata.szInfo, msg, sizeOf(icondata.szInfo)-1);
strPLCopy(icondata.szInfoTitle, title, sizeOf(icondata.szInfoTitle)-1);
icondata.uVersion:=round(secondsTimeout*1000);
icondata.uFlags := icondata.uFlags or NIF_INFO;
update();
icondata.uFlags := icondata.uFlags and not NIF_INFO;
result:=TRUE;
end;

function TmyTrayIcon.balloon(msg:string; secondsTimeout:real):boolean;
begin
balloon(msg,'','',secondsTimeout);
end; // balloon

This modification is great important because it will be in the French version, and because if it it is not resumed in the build 270, the silentpliz will not be really satisfied  Angry Sad Undecided Cry Embarrassed, because it is him who had the idea. Wink Cheesy

example:

Quote
var
  s: string;
begin
if externalIP = '' then exit;
mainfrm.setStatusBarText('Updating dynamic DNS...', 5);
tray.balloon('Updating dynamic DNS...', 5);

dyndns.lastTime:=now();
try s:=httpGet(xtpl(dyndns.url, ['%ip%', externalIP]));

........

procedure TmainFrm.Restoredefault1Click(Sender: TObject);
begin
if msgDlg('Continue?', MB_ICONQUESTION+MB_YESNO) = MRNO then exit;
tplFilename:='';
tplLast:=-1;
tplImport:=TRUE;
setStatusBarText('The template has been reset');
tray.balloon('The template has been reset', 5);
end;
and some others..  Wink
Logged
rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11831


View Profile
« Reply #1 on: September 14, 2010, 10:30:41 AM »

i don't understand, what's the difference? you can already call balloon() for other purposes
Logged
Mars
Operator
Insane poster
*****
Offline Offline

France France

Posts: 1481



View Profile WWW
« Reply #2 on: September 14, 2010, 02:39:55 PM »

The syntax of balloon (string, TtrayMessageType, string, integer) was too much complicated for silentpliz, simpler for him to memorize the following formula (string, string, string, integer) and to add the possibility to use balloon(text,time) and not balloon(text, '', '', time)

Finally it is rather in silentpliz to defend his beefsteak  Grin Cheesy
Logged
rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11831


View Profile
« Reply #3 on: September 15, 2010, 04:28:42 AM »

for balloon(text,time) i changed the order of parameters instead of overloading. Ok?

about the TtrayMessageType,
1. it's considered bad practice because the "enum" type prevents you from mistyping 'warming' and wondering why it's not working
2. from 'warning' to TM_WARNING it's just an extra char, not a big deal.
Logged
TCube
Insane poster
*****
Offline Offline

France France

Posts: 431



View Profile
« Reply #4 on: September 15, 2010, 11:10:09 AM »

for balloon(text,time) i changed the order of parameters instead of overloading. Ok?

about the TtrayMessageType,
1. it's considered bad practice because the "enum" type prevents you from mistyping 'warming' and wondering why it's not working
2. from 'warning' to TM_WARNING it's just an extra char, not a big deal.

Rejetto, I agree, as mention by Mars - " .../... this only concernes the 'French Version.../... "  inspite of "improuvements within the code" theses will be never in anyway deployed on any other  Templates "mods"

T3
« Last Edit: September 15, 2010, 11:12:12 AM by TCube » Logged

Make it idiot-proof and I will make a better idiot
SilentPliz
Operator
Insane poster
*****
Offline Offline

France France

Posts: 1046


....... chut ! shh!


View Profile WWW
« Reply #5 on: September 15, 2010, 12:08:33 PM »

Rejetto, I agree, as mention by Mars - " .../... this only concernes the 'French Version.../... "  inspite of "improuvements within the code" theses will be never in anyway deployed on any other  Templates "mods"

T3

This topic only concern internal messages "tray balloon" (error & other...) in hfs.exe. The syntax for templates is not modified.
For tray balloon notifications in templates "mods", an diff template exist... for who want it.

http://www.rejetto.com/forum/index.php/topic,9000.msg1051769.html#msg1051769
Logged
rejetto forum
« Reply #5 on: September 15, 2010, 12:08:33 PM »

Do you like this software? Consider even $2
 Logged
Mars
Operator
Insane poster
*****
Offline Offline

France France

Posts: 1481



View Profile WWW
« Reply #6 on: September 16, 2010, 09:13:47 AM »

Quote
for balloon(text,time) i changed the order of parameters instead of overloading. Ok?

To change the order for it would be good

function TmyTrayIcon.balloon(msg:string; secondsTimeout:real; kind:TtrayMessageType; title:string):boolean;

more easy to use tray.balloon('blablabla',10); instead of tray.balloon('blablabla', '', '', 10);


Silentpliz began to complain to have pain in fingers due to writing many of  '', '',

 Cheesy Grin
Logged
SilentPliz
Operator
Insane poster
*****
Offline Offline

France France

Posts: 1046


....... chut ! shh!


View Profile WWW
« Reply #7 on: September 16, 2010, 09:27:12 AM »

Quote
for balloon(text,time) i changed the order of parameters instead of overloading. Ok?

It's perfect for me. Wink

Silentpliz began to complain to have pain in fingers due to writing many of   '', '',

Now I have a whitlow as big as a pingpong ball on each fingers. Grin
« Last Edit: September 16, 2010, 09:55:54 AM by SilentPliz » Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!


Google visited last this page Today at 12:15:31 AM