Re: Functions? I'm Lost!!

new topic     » goto parent     » topic index » view thread      » older message » newer message

------=_NextPart_000_0019_01BFC031.DC64FE80
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi Dave,

    Most libs use functions to return a value to the calling program, =
since they can't directly put a value to the program variables.
IE. David Cuny's  winlib..
    when you create a control( a window or listbox or whatever), it =
returns a handle so you can access the control you created later.

example..

<CODE>

include win32lib.ew

constant
   =
,0),
                 -- ^^ this is a function. it returns a handle so winlib =
can manipulate it in later code
    Mnu_File=3Dcreate(Menu,"&File", Win_Main,0,1,0,0,0),
  -- ^^  the value returned by create..... ^^ this is the handle return =
by creating the window
       Mnu_Fexit=3Dcreate(MenuItem,"E&xit",Mnu_File,0,0,0,0,0)
-------------------------------------------------------------------------=
-----
--EVENTS
procedure onMnu_Fexit()
   closeWindow(Win_Main)
end procedure
-------------------------------------------------------------------------=
-----
--EVENTS

onClick [Mnu_Fexit] =3D routine_id("onMnu_Fexit")
                                -- ^^ this is a function too..

WinMain(Win_Main, Normal)

</CODE>

Chris

------=_NextPart_000_0019_01BFC031.DC64FE80
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2314.1000" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT color=3D#0000ff face=3D"Comic Sans MS">Hi Dave,</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT color=3D#0000ff face=3D"Comic Sans MS">&nbsp;&nbsp;&nbsp; =
Most libs use=20
functions to return a value to the calling program, since they can't =
directly=20
put a value to the program variables.</FONT></DIV>
<DIV><FONT color=3D#0000ff face=3D"Comic Sans MS">IE.&nbsp;David Cuny's  =

winlib..</FONT></DIV>
<DIV><FONT color=3D#0000ff face=3D"Comic Sans MS">&nbsp;&nbsp;&nbsp; =
when you create=20
a control( a window or listbox or whatever), it returns a handle so you =
can=20
access the control you created later.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT color=3D#0000ff face=3D"Comic Sans MS">example..</FONT></DIV>
<DIV><FONT color=3D#0000ff face=3D"Comic Sans MS"></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#0000ff face=3D"Comic Sans =
MS">&lt;CODE&gt;</FONT></DIV>
<DIV><FONT color=3D#0000ff face=3D"Comic Sans MS"></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#0000ff face=3D"Comic Sans MS">include =
win32lib.ew</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT color=3D#0000ff face=3D"Comic Sans =
MS">constant<BR>&nbsp;&nbsp;=20
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
-- ^^ this is a function. it returns a handle so winlib can manipulate =
it in=20
later code</FONT></DIV>
<DIV><FONT color=3D#0000ff face=3D"Comic Sans MS">&nbsp;&nbsp;&nbsp;=20
Mnu_File=3Dcreate(Menu,"&amp;File", Win_Main,0,1,0,0,0),</FONT></DIV>
<DIV><FONT color=3D#0000ff=20
face=3D"Comic Sans MS">&nbsp;&nbsp;--&nbsp;^^&nbsp;&nbsp;the value =
returned by=20
create..... ^^ this is the handle return by creating the=20
window<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
NT=20
color=3D#0000ff=20
face=3D"Comic Sans =
MS">---------------------------------------------------------------------=
---------<BR>--EVENTS</FONT></DIV>
<DIV><FONT color=3D#0000ff face=3D"Comic Sans MS">procedure=20
onMnu_Fexit()<BR>&nbsp;&nbsp; closeWindow(Win_Main)<BR>end=20
procedure</FONT></DIV>
<DIV><FONT color=3D#0000ff=20
face=3D"Comic Sans =
MS">---------------------------------------------------------------------=
---------<BR>--EVENTS</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT color=3D#0000ff face=3D"Comic Sans MS">onClick [Mnu_Fexit] =
=3D=20
routine_id("onMnu_Fexit")</FONT></DIV>
<DIV><FONT color=3D#0000ff face=3D"Comic Sans MS">&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; -- ^^ this is=20
a&nbsp;function too..<BR></DIV></FONT><FONT color=3D#0000ff=20
face=3D"Comic Sans MS"></FONT>
<DIV><FONT color=3D#0000ff face=3D"Comic Sans MS">WinMain(Win_Main,=20
Normal)</FONT></DIV>
<DIV><FONT color=3D#0000ff face=3D"Comic Sans MS"></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#0000ff face=3D"Comic Sans =
MS">&lt;/CODE&gt;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT color=3D#0000ff face=3D"Comic Sans =

------=_NextPart_000_0019_01BFC031.DC64FE80--

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu