🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.ms.programmer
Article #3430

Re: Using TPW-like dialog boxes

#3430
From: cantva
Date: Wed, 26 Jun 1991 23:17
33 lines
2248 bytes
From article <91176.212130IO80141@MAINE.MAINE.EDU>, by IO80141@MAINE.MAINE.EDU (Steve Trefethen):
> I would like to know how to make dialog boxes that look like the ones
> used in TPW.  Basically I would like to change the background of the
> dialog box using bitmaps.  I have used the WRT to look at the dialogs
> that come with TPW but I can't seem to figure out how the background
> is made.  The bitmaps that are in the resources of TPW are very small
> so the patterns just must be repeated repeated and that is what I would
> like to know how to do.

Here are some thoughts about how to go about constructing TPW-style
boxes (I haven't tried these out)

Firstly, for the background, try loading the bitmap, creating a brush
out of it, then assigning this brush to the  hbrBackground field of a
TWndClass record, and registering this window class.
To expand:
you will need to call
LoadBitmap, then
CreatePatternBrush(bitmapName), then go through the process described in
page 124... of the Windows Programming Guide from TPW.  Basically you
override the GetClassName and the GetWindowClass methods of your window.
It's not too difficult (easier than I thought).

For the custom buttons, look at bitbtn.pas and bitbtnapp.pas.  
Also look at the bs_OwnerDraw button styles.  You will need to provide 
methods for the wm_DrawItem message to draw them selected and unselected
yourself.  Something I had trouble with at first: the hDC element of the
PDrawItemStruct that you get passed in your wm_DrawItem handler just 
encloses the button area; it does not relate to the whole window,
so when you draw the button, make its top left corner at 0, 0!

All the best,
Craig Nevill (craig@cosc.canterbury.ac.nz)
Technical Details
Message-ID: <1991Jun27.111711.1211@csc.canterbury.ac.nz>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!samsung!uunet!comp.vuw.ac.nz!waikato.ac.nz!canterbury.ac.nz!cosc.canterbury.ac.nz!craig
References: <91176.212130IO80141@MAINE.MAINE.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!samsung!uunet!comp.vuw.ac.nz!waikato.ac.nz!canterbury.ac.nz!cosc.canterbury.ac.nz!craig
From: craig@cosc.canterbury.ac.nz (cantva)
Newsgroups: comp.windows.ms.programmer
Subject: Re: Using TPW-like dialog boxes
Message-ID: <1991Jun27.111711.1211@csc.canterbury.ac.nz>
Date: 26 Jun 91 23:17:10 GMT
References: <91176.212130IO80141@MAINE.MAINE.EDU>
Reply-To: craig@cosc.canterbury.ac.nz
Lines: 33
Nntp-Posting-Host: kiwi.cosc.canterbury.ac.nz