Recent

Author Topic: "Charles Petzold" Style Programming Book or Document?  (Read 1739 times)

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8887
  • FPC developer.
Re: "Charles Petzold" Style Programming Book or Document?
« Reply #15 on: September 27, 2020, 09:36:05 pm »
An example program is available with FPC install in demo/win32/edit.pp

"Tomes of Delphi Win32" api and win32 graphics api might also be good books

pmckone

  • New member
  • *
  • Posts: 5
Re: "Charles Petzold" Style Programming Book or Document?
« Reply #16 on: September 28, 2020, 12:34:39 am »
I didn't make the original question clear enough.  I actually already know how to write old-fashioned Win32 programs in C.  I wrote Algol at Burroughs around 1980, and Pascal on a Convergent Technologies machine in 1982, and converting 'C' code to Pascal isn't too hard.  What I'm hoping to find is an explanation of how to use the component libraries, but without using a form designer.  Many years ago I found a book "Introduction to MFC Programming with Visual C++" written by Richard M. Jones.  He explains how to write what he calls "Handcrafted MFC Programs".  I was hoping to find a similar book about writing Delphi programs by hand.  It's beginning to look like no such book exists.  That's okay.  It wouldn't be the first time I tried to find something that doesn't exist!
« Last Edit: September 28, 2020, 12:36:29 am by pmckone »

MarkMLl

  • Hero Member
  • *****
  • Posts: 1445
Re: "Charles Petzold" Style Programming Book or Document?
« Reply #17 on: September 28, 2020, 08:51:28 am »
I for one understand perfectly well what you're saying. And I'd point out that when LBS transitioned from using a Medium System to a B7800 circa 1981 they hired about 25 coders to design TD830J and Modular Terminal screens for them... work that these days is almost entirely automated.

MarkMLl
Turbo Pascal v1 on CCP/M-86, multitasking with LAN and graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8887
  • FPC developer.
Re: "Charles Petzold" Style Programming Book or Document?
« Reply #18 on: September 28, 2020, 09:30:59 am »
Many years ago I found a book "Introduction to MFC Programming with Visual C++" written by Richard M. Jones.  He explains how to write what he calls "Handcrafted MFC Programs".  I was hoping to find a similar book about writing Delphi programs by hand.  It's beginning to look like no such book exists.  That's okay.  It wouldn't be the first time I tried to find something that doesn't exist!

I don't think there is a book, but it is quite common to do at least parts (like whole forms) by hand. The designer operates on textfiles (lfm/dfm and .pas/pp), and just watching what changes it makes is often enough.

lainz

  • Hero Member
  • *****
  • Posts: 3800
  • Leandro Diaz
Re: "Charles Petzold" Style Programming Book or Document?
« Reply #19 on: September 29, 2020, 01:57:45 am »
Well HTML, JavaScript and CSS are all by hand, there are editors but you can not use them if you like  :P

So what's the point =)
https://lainz.github.io/
Download LazPaint https://lazpaint.github.io/
Download BGRABitmap and BGRAControls https://github.com/bgrabitmap

MarkMLl

  • Hero Member
  • *****
  • Posts: 1445
Re: "Charles Petzold" Style Programming Book or Document?
« Reply #20 on: September 29, 2020, 09:02:22 am »
Well HTML, JavaScript and CSS are all by hand, there are editors but you can not use them if you like  :P

Which is why I mentioned Borland Intranet Builder (?) and Netscape Visual Javascript in my list earlier. The distinguishing feature is that they know how to hook Javascript onto DOM events, even if they don't provide as much coding and debugging support as Delphi etc.

The fact that an influential group of people refuses to use available tools doesn't make their refusal praiseworthy.

MarkMLl
Turbo Pascal v1 on CCP/M-86, multitasking with LAN and graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.

valdir.marcos

  • Hero Member
  • *****
  • Posts: 1007
Re: "Charles Petzold" Style Programming Book or Document?
« Reply #21 on: September 29, 2020, 11:20:46 am »
Topic: "Charles Petzold" Style Programming Book or Document?

Can I get a recommendation for a book or document that explains how to write programs that use the component libraries WITHOUT using a form designer?  Every book that I look at starts out with dragging and dropping controls onto a form, and then augmenting code that is generated by a form designer.  I'm more comfortable writing all the code myself.  Thanks.
Just curiosity.
Which books specifically are you referring to?
http://www.computerofthetides.com/bio.html
https://en.wikipedia.org/wiki/Charles_Petzold
https://www.charlespetzold.com/
https://www.amazon.com/Charles-Petzold/e/B000APETXO%3Fref=dbs_a_mng_rwt_scns_share
https://www.amazon.com/Books-Charles-Petzold/s?rh=n%3A283155%2Cp_27%3ACharles+Petzold

valdir.marcos

  • Hero Member
  • *****
  • Posts: 1007
Re: "Charles Petzold" Style Programming Book or Document?
« Reply #22 on: September 29, 2020, 12:44:08 pm »
I didn't make the original question clear enough.  I actually already know how to write old-fashioned Win32 programs in C.  I wrote Algol at Burroughs around 1980, and Pascal on a Convergent Technologies machine in 1982, and converting 'C' code to Pascal isn't too hard.  What I'm hoping to find is an explanation of how to use the component libraries, but without using a form designer.  Many years ago I found a book "Introduction to MFC Programming with Visual C++" written by Richard M. Jones.  He explains how to write what he calls "Handcrafted MFC Programs".  I was hoping to find a similar book about writing Delphi programs by hand.  It's beginning to look like no such book exists.  That's okay.  It wouldn't be the first time I tried to find something that doesn't exist!
Like marcov said, I also don't think there is such a book, but the internet is full of Delphi examples that would work on Lazarus:
https://stackoverflow.com/questions/16112924/how-to-create-a-form-programmatically-with-a-couple-components-on-it-in-delphi
https://stackoverflow.com/questions/43450671/how-to-create-a-new-form-dynamically-and-inherit-the-form-from-an-existing-form
http://www.festra.com/wwwboard/messages/12948.html


Introduction to MFC Programming with Visual C++,  Richard M. Jones, 2000:
https://catalyst.library.jhu.edu/catalog/bib_2150987
https://archive.org/details/introductiontomf00rich/page/n5/mode/2up

pmckone

  • New member
  • *
  • Posts: 5
Re: "Charles Petzold" Style Programming Book or Document?
« Reply #23 on: September 29, 2020, 06:52:16 pm »
The Petzold books that I own are "Programming Windows" (versions for 3.0, 95, and 98), "Programming Windows with C#" and the update "Programming Windows Forms" and "Applications = Code + Markup", which is about Windows Presentation Foundation.  I stopped reading this last book when I realized the the "SpinBox" control was not included in WPF.  I don't think Petzold used a form designer (Or "AppWizard") to produce any of examples in any of these books except possibly the last one, which I didn't finish. 

In my case, I am constructing a chessboard using an 8x8 array of Rich Text boxes, all sharing the same event handler.  I have already written this program in C#, but now I need it in Pascal, to merge with the old Turbo Games chess program.  I think it would take me longer to learn how create a two-dimensional array of text boxes in the form designer than it will take to write the code directly.  Why am I using Rich Text boxes to make the squares on the board?  Because is reduces the amount of keyboard handling code that I have to write.

Handoko

  • Hero Member
  • *****
  • Posts: 3902
  • My goal: build my own game engine using Lazarus
Re: "Charles Petzold" Style Programming Book or Document?
« Reply #24 on: September 29, 2020, 07:41:37 pm »
What I'm hoping to find is an explanation of how to use the component libraries, but without using a form designer.

I wonder why you avoid using form designer. It is easy to learn and you can develop programs in much less time.

You mentioned you're writing games, glad to meet someone who likes writing games here. Maybe you're interested to learn writing a simple snake game I wrote some time ago:
https://forum.lazarus.freepascal.org/index.php/topic,38136.msg258381.html#msg258381

There you can learn reading user input, using TTimer as a game loop, using buffer for better keyboard input, how to reduce flickering, and many basic things for writing games. As you're already able to write games in C#, I'm sure you already knew about them but you might be don't know how to do them in Pascal. Unfortunately that thread is very long and messy.

If you're new in Pascal/Lazarus, I recommend you this page:
https://wiki.freepascal.org/Portal:HowTo_Demos

You can find many short demos especially in the 'Graphics' and 'User Interface' categories, which can help you learn GUI programming easier.

MarkMLl

  • Hero Member
  • *****
  • Posts: 1445
Re: "Charles Petzold" Style Programming Book or Document?
« Reply #25 on: September 29, 2020, 08:39:18 pm »
I don't think Petzold used a form designer (Or "AppWizard") to produce any of examples in any of these books except possibly the last one, which I didn't finish.

For exactly the same reason that cavemen didn't use matches to light their fire: such things did not exist.

Petzold's reputation was founded on his work with DOS and Windows 3.x To a very large extent hos subsequent books hewed carefully to the same format, with the intention that they helped his existing clientele adapt to the new technology. He left other people to write about development tools.

Quote
In my case, I am constructing a chessboard using an 8x8 array of Rich Text boxes, all sharing the same event handler.  I have already written this program in C#, but now I need it in Pascal, to merge with the old Turbo Games chess program.  I think it would take me longer to learn how create a two-dimensional array of text boxes in the form designer than it will take to write the code directly.  Why am I using Rich Text boxes to make the squares on the board?  Because is reduces the amount of keyboard handling code that I have to write.

Get a form, slap an 8x8 array of panels onto it. Or use a TDrawGrid. Or just about anything. Because the work you make for yourself and the grief you cause the community insisting on doing everything by hand will far exceed the work and grief associated with helping you out with keyboard handling.

MarkMLl

(Who's BT, DT, spent far too much time reinventing the wheel and bashing his head against tools when he's tried to abuse them, and wishes that less experienced users would just now and then /listen/ to what people were trying to tell them.)
Turbo Pascal v1 on CCP/M-86, multitasking with LAN and graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.

 

TinyPortal © 2005-2018