1. Drawing Lines to Window

I am having trouble drawing lines on a simple window.The literature suggests
this can be done without having to resort to using
device contexts. Can anyone tell me please what I'm doing wrong.
Regards
Bob

new topic     » topic index » view message » categorize

2. Re: Drawing Lines to Window

Hope this helps. I had the same problem..you had to put the line draw in the
onpaint procedure that is triggered

-- OpenWindows4
-- A demonstration on how to use David Cuny's Win32LIB to create, open,
-- close, and reopen windows. I wrote this to get a better idea on how
-- David's excellent Windows GUI wrapper works.

-- This program will be used to create a very simple text editor. The
-- program will allow the loading and saving of text.

without warning -- gets rid of all those annoying messages after completion


include win32lib.ew

-- Main Window (at position 10,10, width = 400, height = 400)
constant MainWindow = create(Window,"Project Open Windows, Stage IV",
                        0, 10, 10, 400, 400, 0)

-- What to do if the windows needs to be repainted (note this is where you
-- draw a line

procedure RepaintMain(integer x1,integer y1,integer x2,integer y2)
setPenStyle(MainWindow, Solid)
setPenColor(MainWindow, BrightWhite )
drawLine(MainWindow, 10, 10, 390, 390 )
end procedure

onPaint[MainWindow] = routine_id("RepaintMain")

WinMain(MainWindow, Normal)



----- Original Message -----
From: "bobspringett" <bobspringett at WANADOO.FR>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Sunday, August 13, 2000 8:48 AM
Subject: Drawing Lines to Window


> I am having trouble drawing lines on a simple window.The literature
suggests this can be done without having to resort to using
> device contexts. Can anyone tell me please what I'm doing wrong.
> Regards
> Bob
>

new topic     » goto parent     » topic index » view message » categorize

3. Re: Drawing Lines to Window

Many Thanks for your help David
Regards Bob
----- Original Message -----
From: David Alan Gay <moggie at INTERLOG.COM>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Sunday, August 13, 2000 4:13 PM
Subject: Re: Drawing Lines to Window


> Hope this helps. I had the same problem..you had to put the line draw in the
> onpaint procedure that is triggered
>
> -- OpenWindows4
> -- A demonstration on how to use David Cuny's Win32LIB to create, open,
> -- close, and reopen windows. I wrote this to get a better idea on how
> -- David's excellent Windows GUI wrapper works.
>
> -- This program will be used to create a very simple text editor. The
> -- program will allow the loading and saving of text.
>
> without warning -- gets rid of all those annoying messages after completion
>
>
> include win32lib.ew
>
> -- Main Window (at position 10,10, width = 400, height = 400)
> constant MainWindow = create(Window,"Project Open Windows, Stage IV",
>                         0, 10, 10, 400, 400, 0)
>
> -- What to do if the windows needs to be repainted (note this is where you
> -- draw a line
>
> procedure RepaintMain(integer x1,integer y1,integer x2,integer y2)
> setPenStyle(MainWindow, Solid)
> setPenColor(MainWindow, BrightWhite )
> drawLine(MainWindow, 10, 10, 390, 390 )
> end procedure
>
> onPaint[MainWindow] = routine_id("RepaintMain")
>
> WinMain(MainWindow, Normal)
>
>
>
> ----- Original Message -----
> From: "bobspringett" <bobspringett at WANADOO.FR>
> To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
> Sent: Sunday, August 13, 2000 8:48 AM
> Subject: Drawing Lines to Window
>
>
> > I am having trouble drawing lines on a simple window.The literature
> suggests this can be done without having to resort to using
> > device contexts. Can anyone tell me please what I'm doing wrong.
> > Regards
> > Bob
> >

new topic     » goto parent     » topic index » view message » categorize

4. Re: Drawing Lines to Window

Dan,
First of all thanks for the info.
Secondly 'device contexts' are 'thingies' you need to draw graphics and text to
the screen and the printer. (see Petzold's book on
Windows Programming.
ie hdc=getDC(hWnd), then you are able to Draw to the sceen with the API
functions of GDI32.
It seems that David Cuny has made this transparent to the user. It's probably in
the onPaint() FNCTION.
Regards
Bob
----- Original Message -----
From: Dan B Moyer <DANMOYER at PRODIGY.NET>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Sunday, August 13, 2000 3:52 PM
Subject: Re: Drawing Lines to Window


> Bob,
>
> I don't know what you mean by "device contexts", but the following works:
>
> <code follows>
>
> --  demonstrates drawing a line in a window:
>
> include Win32Lib.ew
> without warning
>
> constant MainWin = create(Window,"a line",0,0,0,400,400,0)
>
> -----------------------------------------------------------
> procedure MakeAline(integer x1, integer y1, integer x2, integer y2)
>    drawLine(MainWin, 10,10,300,300)
> end procedure
> ------------------------------------------------
> onPaint[MainWin] = routine_id("MakeAline")
> ---------------------------------------------
> WinMain( MainWin, Normal )
> ----------------------------------------------------------------------------
> -
>
> <code ends>
>
> ----- Original Message -----
> From: "bobspringett" <bobspringett at WANADOO.FR>
> To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
> Sent: Sunday, August 13, 2000 5:48 AM
> Subject: Drawing Lines to Window
>
>
> > I am having trouble drawing lines on a simple window.The literature
> suggests this can be done without having to resort to using
> > device contexts. Can anyone tell me please what I'm doing wrong.
> > Regards
> > Bob

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu