Where"s the -1 go? (Not another troll question)

Where"s the -1 go? (Not another troll question)

am 05.08.2011 15:34:23 von Deane.Rothenmaier

--===============1840543100==
Content-Type: multipart/alternative;
boundary="_000_115007D93766724DAE9F518846E121DE93873BDMSS8MP 2MBwagreso_"
Content-Language: en-US

--_000_115007D93766724DAE9F518846E121DE93873BDMSS8MP2MBwagre so_
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset="us-ascii"

Geniuses, Gurus, Wizards, et. al...

I'm working on some Win32::GUI code, with no formal training, and just enou=
gh OTJ to be really dangerous. I've come up against a couple of questions =
that I cannot find answers to in my books. Here's the code:

#===============3D
sub Exit_Click {
#===============3D
MainWindow_Terminate();
}

#===================3D=3 D=====
=3D
sub MainWindow_Terminate {
#===================3D=3 D=====
=3D
print LOG "=3D"x80 . "\n";
close( LOG );
return( -1 );
}

And here's the questions:
First, when Exit_Click (E_C) calls MainWindow_Terminate (MW_T), it does not=
hing with the -1 that MW_T returns-or at least it looks that way (it is GUI=
, after all, and I'm learning that GUI does a lot of, um, "invisible" stuff=
). So where does that -1 go? Into the bit bucket? Or does GUI do some behin=
d-the-curtain prestidigitation with it? If this wasn't GUI code, I'd feel =
confident believing that it's just ignored. But it is. So I don't.

Second: Is there some GUI-related requirement behind E_C calling MW_T inste=
ad of doing, in its own code, the stuff MW_T does? That is, is there someth=
ing in the murky depths of Win32::GUI that's expecting a "thing" called Exi=
t_Click to call another "thing" called MainWindow_Terminate?

Thanks for sharing your wisdom.

Deane Rothenmaier
Programmer/Analyst - IT-StdCfg
Walgreens Corp.
2 Overlook Point #N51022D
MS 6515
Lincolnshire, IL 60069
224-542-5150

Vincit qui patitur. -- Persius


--_000_115007D93766724DAE9F518846E121DE93873BDMSS8MP2MBwagre so_
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset="us-ascii"

osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" xmlns=3D"http:=
//www.w3.org/TR/REC-html40">

>





Geniuses, Gurus, Wizards, et. al… p>

 


I’m working on some Win32::GUI code, with no f=
ormal training, and just enough OTJ to be really dangerous.  I’v=
e come up against a couple of questions that I cannot find answers to in my=
books.  Here’s the code:


 


urier New"">#===============3D<=
/span>


urier New"">sub Exit_Click {


urier New"">#===============3D<=
/span>


urier New"">   MainWindow_Terminate();


urier New"">}


urier New""> 


urier New" ">#===================3D =
======


urier New"">sub MainWindow_Terminate {


urier New" ">#===================3D =
======


urier New"">   print LOG "=3D"x80 . "\n"=
;


urier New"">   close( LOG );


urier New"">   return( -1 );


urier New"">}


 


And here’s the questions:


First, when Exit_Click (E_C) calls MainWindow_Termin=
ate (MW_T), it does nothing with the -1 that MW_T returns—or at least=
it looks that way (it
is GUI, after all, and I’m learning that GUI does a lot of, um=
, “invisible” stuff). So where does that -1 go? Into the bit bu=
cket? Or does GUI do some behind-the-curtain prestidigitation with it? =
; If this wasn’t GUI code, I’d feel confident believing
that it’s just ignored. But it is. So I don’t.


 


Second: Is there some GUI-related requirement behind=
E_C calling MW_T instead of doing, in its own code, the stuff MW_T does? T=
hat is, is there something in the murky depths of Win32::GUI that’s e=
xpecting a “thing” called Exit_Click to
call another “thing” called MainWindow_Terminate? p>

 


Thanks for sharing your wisdom.


 


Deane Rothenmaier


Programmer/Analyst – IT-StdCfg


Walgreens Corp.


2 Overlook Point #N51022D


MS 6515


Lincolnshire, IL 60069


224-542-5150


 


Vincit qui patitur. -- Persius


 






--_000_115007D93766724DAE9F518846E121DE93873BDMSS8MP2MBwagre so_--


--===============1840543100==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============1840543100==--

Re: Where"s the -1 go? (Not another troll question)

am 05.08.2011 16:08:13 von Christian Walde

On Fri, 05 Aug 2011 15:34:23 +0200, Rothenmaier, Deane C. wrote:

> Geniuses, Gurus, Wizards, et. al...
>
> I'm working on some Win32::GUI code, with no formal training, and just enough OTJ to be really dangerous. I've come up against a couple of questions that I cannot find answers to in my books. Here's the code:
>
> #===============
> sub Exit_Click {
> #===============
> MainWindow_Terminate();
> }
>
> #=========================
> sub MainWindow_Terminate {
> #=========================
> print LOG "="x80 . "\n";
> close( LOG );
> return( -1 );
> }
>
> And here's the questions:
> First, when Exit_Click (E_C) calls MainWindow_Terminate (MW_T), it does nothing with the -1 that MW_T returns-or at least it looks that way (it is GUI, after all, and I'm learning that GUI does a lot of, um, "invisible" stuff). So where does that -1 go? Into the bit bucket? Or does GUI do some behind-the-curtain prestidigitation with it? If this wasn't GUI code, I'd feel confident believing that it's just ignored. But it is. So I don't.

Strictly speaking the -1 is returned by Exit_Click, since the result of the last line executed in a sub is always returned by that sub. So if whatever calls E_C does something with its return value, then you cannot assume it's being ignored.

--
With regards,
Christian Walde
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

RE: Where"s the -1 go? (Not another troll question)

am 05.08.2011 16:14:56 von Deane.Rothenmaier

Thanks, Christian.

So, If I'm understanding you correctly, Exit_Click just passes the -1 from MW_T back up the chain to whatever called *it*? So it ends up somewhere in a black GUI box?

Deane Rothenmaier
Programmer/Analyst - IT-StdCfg
Walgreens Corp.
2 Overlook Point #N51022D
MS 6515
Lincolnshire, IL 60069
224-542-5150

Vincit qui patitur. -- Persius

-----Original Message-----
From: Christian Walde [mailto:mithaldu@yahoo.de]
Sent: Friday, August 05, 2011 9:08 AM
To: activeperl@listserv.ActiveState.com; Rothenmaier, Deane C.
Subject: Re: Where's the -1 go? (Not another troll question)

On Fri, 05 Aug 2011 15:34:23 +0200, Rothenmaier, Deane C. wrote:

> Geniuses, Gurus, Wizards, et. al...
>
> I'm working on some Win32::GUI code, with no formal training, and just enough OTJ to be really dangerous. I've come up against a couple of questions that I cannot find answers to in my books. Here's the code:
>
> #===============
> sub Exit_Click {
> #===============
> MainWindow_Terminate();
> }
>
> #=========================
> sub MainWindow_Terminate {
> #=========================
> print LOG "="x80 . "\n";
> close( LOG );
> return( -1 );
> }
>
> And here's the questions:
> First, when Exit_Click (E_C) calls MainWindow_Terminate (MW_T), it does nothing with the -1 that MW_T returns-or at least it looks that way (it is GUI, after all, and I'm learning that GUI does a lot of, um, "invisible" stuff). So where does that -1 go? Into the bit bucket? Or does GUI do some behind-the-curtain prestidigitation with it? If this wasn't GUI code, I'd feel confident believing that it's just ignored. But it is. So I don't.

Strictly speaking the -1 is returned by Exit_Click, since the result of the last line executed in a sub is always returned by that sub. So if whatever calls E_C does something with its return value, then you cannot assume it's being ignored.

--
With regards,
Christian Walde

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Re: Where"s the -1 go? (Not another troll question)

am 05.08.2011 17:44:34 von Bill Luebkert

On 8/5/2011 7:14 AM, Rothenmaier, Deane C. wrote:
> Thanks, Christian.
>
> So, If I'm understanding you correctly, Exit_Click just passes the -1 from MW_T back up the chain to whatever called *it*? So it ends up somewhere in a black GUI box?

Kinda depends on who called Exit_Click and how. I assume it's a
callback for a menu item, button or some such - so if so, it would most
likely just be ignored unless it was expecting a return from the
callback in which case it could do any number of things including a
possible exit. One would need to know more context to determine the
real answer by looking at the code. Always supply complete but tiny
test cases instead of just little snippets of code and you have a
better chance at a real world answer.
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs