Recent

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

pmckone

  • Newbie
  • Posts: 5
"Charles Petzold" Style Programming Book or Document?
« on: September 26, 2020, 10:13:28 pm »
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.

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: "Charles Petzold" Style Programming Book or Document?
« Reply #1 on: September 26, 2020, 10:35:14 pm »
I sympathise with your search for purity, but quite frankly I think your quest is ill-advised... Quixotic, even.

30 years ago I was selling programming libraries, and to be brutally frank one of the most significant developments /ever/ as far as application development is concerned was the introduction of form/screen designers which allowed a programmer to design his layout graphically.

As precursors, there were various "4GLs" many of which had a modicum of UI design capability. Regrettably, character-based free software hasn't really progressed beyond this point.

There was Visual BASIC for Windows, and ditto for DOS, and Visual C++. There was Delphi, Clarion and Java. There was Intranet Builder from Borland, and Visual Javascript from Netscape.

Those were the progenitors. Hardcoding stuff by hand is Neanderthal in comparison.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Fred vS

  • Hero Member
  • *****
  • Posts: 3158
    • StrumPract is the musicians best friend
Re: "Charles Petzold" Style Programming Book or Document?
« Reply #2 on: September 26, 2020, 10:45:47 pm »
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.

fpGUI is exactly what you want.
https://github.com/graemeg/fpGUI/tree/maint

You may use his designer but the one of the feature of fpGUI is that all is in one file, no form file.
So, perfectly easy to do all by code.

Fre;D
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: "Charles Petzold" Style Programming Book or Document?
« Reply #3 on: September 26, 2020, 10:48:32 pm »
You can use all bitmaps with an opengl library like sdl as well

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: "Charles Petzold" Style Programming Book or Document?
« Reply #4 on: September 26, 2020, 11:09:53 pm »
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.

Hi!

I would recommand not a book but "Turbo Pascal for Windows" from Borland.
They published it 1 year before Delphi - mid 90s.

You reserve some memory,  you create a window pointer, you create a GDI connection, you do this and that - and after one hour you got a window with a Close-Button. Horrible!

Read the post of MarMLI again!

Winni
 

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: "Charles Petzold" Style Programming Book or Document?
« Reply #5 on: September 26, 2020, 11:31:00 pm »
You reserve some memory,  you create a window pointer, you create a GDI connection, you do this and that - and after one hour you got a window with a Close-Button. Horrible!

In fairness, much of the five or six pages of code that was needed for an absolutely minimal program in those days was the message loop... which is distinct from the action of laying out the window (AKA form).

I see no reason why it shouldn't be possible to construct a GUI by hand while letting the message loop remain opaque... although I suspect that that approach would not be acceptable to the OP. See Fred's comment for a good starting point.

I am deeply disturbed by the complexity of modern hardware and software, which I believe soars to an incredible height while being founded on feet of clay. But at the same time I am reluctant to throw away accumulated expertise without very good reason.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

gour

  • New Member
  • *
  • Posts: 17
Re: "Charles Petzold" Style Programming Book or Document?
« Reply #6 on: September 27, 2020, 09:17:28 am »

fpGUI is exactly what you want.
https://github.com/graemeg/fpGUI/tree/maint

You may use his designer but the one of the feature of fpGUI is that all is in one file, no form file.
So, perfectly easy to do all by code.

I was considering to use it in the past, but now when resuming my interest in FreePascal/Lazarus, it looks that fpGUI is not so much in active development - at least, long time without any new release?

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: "Charles Petzold" Style Programming Book or Document?
« Reply #7 on: September 27, 2020, 10:10:33 am »
I see no reason why it shouldn't be possible to construct a GUI by hand while letting the message loop remain opaque... although I suspect that that approach would not be acceptable to the OP. See Fred's comment for a good starting point.

Also it's perfectly possible to create LCL applications in code if one wants. It's just not the standard and most-walked route. :)

440bx

  • Hero Member
  • *****
  • Posts: 3944
Re: "Charles Petzold" Style Programming Book or Document?
« Reply #8 on: September 27, 2020, 04:49:24 pm »
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.
It's hard to recommend a book these days for what you want.

For straight Windows API programming, Petzold's classic book is likely the practical way to go about it but, it requires you have some knowledge of C.  Augment Petzold's book with the Advanced Windows book from Jeffrey Richter and you'll reach a reasonable level of competence in a reasonable amount of time.

For Pascal and pure API, the only book I can think of is Dave Jewel's "Polishing Windows", it's an excellent book but, it is really old.  The examples cater to Windows 95 (or 3.1, I don't remember).  If you use that book, you'll have to tailor/port/adapt to the current API which is not really difficult but, it means that in many cases you don't have examples that work directly as presented.  One feature of Dave Jewel's book that is worth mentioning is that he strongly emphasizes program design and implementation _without_ using global variable which is very desirable as an implementation methodology and as a programming skill.

The other thing that must be mentioned is that, the current "methodology" of using forms and OOP gives the programmer close to instant gratification, which is quite appealing.  Programming pure API doesn't initially come close to instant gratification but, as you write more and more programs, you create a pool of code you can reuse and customize for a particular objective.  Initially, there is a lot more effort involved but, in the long run, you end up with much better programs and, the total time/effort spent while being somewhat greater with pure API, produces noticeably better results. 

If you don't mind the initial greater effort, I encourage you to program to the API.  I do.

HTH.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: "Charles Petzold" Style Programming Book or Document?
« Reply #9 on: September 27, 2020, 05:10:10 pm »
For Pascal and pure API, the only book I can think of is Dave Jewel's "Polishing Windows", it's an excellent book but, it is really old.  The examples cater to Windows 95 (or 3.1, I don't remember).

In certain quarters, Dave is notorious for once announcing that he enjoys taking a pee under the covers. Verity never let him forget that one.

I'm pretty sure that most of his output was related to '95 and later. I'd caution that my understanding is that older APIs (i.e. Win-16) were pretty arbitrary as to which segments they used for parameters etc., so books of that era need to be approached with great caution.

MarkMLl

MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Fred vS

  • Hero Member
  • *****
  • Posts: 3158
    • StrumPract is the musicians best friend
Re: "Charles Petzold" Style Programming Book or Document?
« Reply #10 on: September 27, 2020, 05:55:53 pm »

fpGUI is exactly what you want.
https://github.com/graemeg/fpGUI/tree/maint

You may use his designer but the one of the feature of fpGUI is that all is in one file, no form file.
So, perfectly easy to do all by code.

I was considering to use it in the past, but now when resuming my interest in FreePascal/Lazarus, it looks that fpGUI is not so much in active development - at least, long time without any new release?

> but now when resuming my interest in FreePascal/Lazarus,

fpGUI uses Free Pascal, of course.

> it looks that fpGUI is not so much in active development - at least, long time without any new release

fpGUI is still in development, even more, there is now a "Wayland" branch.

But yes, there are less new commits (last one is from July), maybe because no more bugs?

IMHO, projects like fpGUI or MSEgui are much more active in development than GTK2.

Fre;D


« Last Edit: September 27, 2020, 06:14:26 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: "Charles Petzold" Style Programming Book or Document?
« Reply #11 on: September 27, 2020, 06:12:52 pm »
But yes, there are less new commits (last one is from July), maybe because no more bugs?

You mean it's bugrid? I'll get me coat :-)

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

440bx

  • Hero Member
  • *****
  • Posts: 3944
Re: "Charles Petzold" Style Programming Book or Document?
« Reply #12 on: September 27, 2020, 06:13:39 pm »
<snip> so books of that era need to be approached with great caution.
I agree.  The only books I've seen that are up to date to use the Windows API all cater to C programmers (and possibly C++) not Pascal (probably because there is very limited interest in programming to the API in that segment.)

I would say that anyone wanting to learn the Windows API has to either learn C or be conversant/familiar with C.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Fred vS

  • Hero Member
  • *****
  • Posts: 3158
    • StrumPract is the musicians best friend
Re: "Charles Petzold" Style Programming Book or Document?
« Reply #13 on: September 27, 2020, 06:20:50 pm »
But yes, there are less new commits (last one is from July), maybe because no more bugs?

You mean it's bugrid? I'll get me coat :-)

MarkMLl

I said "maybe" ...

;-)

(By the way, if you find a bug in MSEgui, I offer you a new jacket.)

Fre;D

I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

cdavidson

  • New member
  • *
  • Posts: 9
Re: "Charles Petzold" Style Programming Book or Document?
« Reply #14 on: September 27, 2020, 07:01:02 pm »
For a good Delphi sample of straight Win32 programming, Chapter 23 of Ivan Hladni's 'Inside Delphi 2006' has a good basic coverage.  You can pick up a copy pretty cheap.  I have used that code as a base for a lot of low level Windows programming.  Once you see the pascal code you will see that low level in Free Pascal is not much different than the C code.  When I say Win32, the code will still work on Win64 either as a 32 or 64 compile.

Actually, I would say that 95+% of that book applies perfectly to Free Pascal and to Lazarus.

 

TinyPortal © 2005-2018