Windows Newbie 
Author Message
 Windows Newbie

As a school student, I am currently learning to
program using Turbo Pascal for Windows. Having
completed the basic tasks with ease, I am looking
to begin creating programs with a GUI. Items such
as menus, buttons and dialog boxes are a mystery
to me and documentation is poor or non-existent.
Could any of you kind people provide me with (or
a link to )a guide to using Object Windows and
resource workshop etc?

Any help will be gratefully received.

James Nugent

PS Please send any replies to my email address :

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Wed, 18 Jun 1902 08:00:00 GMT  
 Windows Newbie

Quote:

> As a school student, I am currently learning to
> program using Turbo Pascal for Windows. Having
> completed the basic tasks with ease, I am looking
> to begin creating programs with a GUI. Items such
> as menus, buttons and dialog boxes are a mystery
> to me and documentation is poor or non-existent.
> Could any of you kind people provide me with (or
> a link to )a guide to using Object Windows and
> resource workshop etc?

The following is a basic Windows GUI program. It displays a message box
when the user clicks on a button.

uses odialogs, owindows, wintypes, winprocs;
const
  id_AButton = 101;
type
  TApp = object(TApplication)
           procedure InitMainWindow; virtual;
         end;
  PWin = ^TWin;
  TWin = object(TWindow)
           AButton : PButton;
           constructor Init(AParent: PWindowsObject; ATitle: PChar);
           procedure ButtonClick; virtual id_First + id_AButton;
         end;

constructor TWin.Init(AParent: PWindowsObject; ATitle: PChar);
begin
  inherited Init(AParent, ATitle);


100, 25, true));
end;

procedure TWin.ButtonClick;
begin
  MessageBox(0, 'You clicked on the button', 'Hello', mb_ok)
end;

procedure TApp.InitMainWindow;
begin
  MainWindow := new(PWin, Init(nil, 'Hello World'))
end;

var
  App : TApp;
begin
  App.Init('');
  App.Run;
  App.Done
end.

This creates a new instance of TApplication. TApplication.Init always
calls the procedure InitMainWindow to create the main window of the
application. I have rewritten it to create a window of type TWin. TWin
is an object of type TWindow.
Then, the inherited constructor of TWindow is called using "inherited
Init". The line starting with AButton simply creates a new object of
type TButton. The button appears in the window.

You must of course tell which procedure should be called when the user
clicks on the button. You do this by defining a procedure in the window
object declaration, and adding "virtual id_First + id_xxx". Replace
id_xxx by the ID assigned to the button during its creation with
New(PButton, Init(...)). In this case, it's id_AButton.

Quote:
> PS Please send any replies to my email address :


No. Explanation sent via email.


Wed, 18 Jun 1902 08:00:00 GMT  
 Windows Newbie

Quote:
>As a school student, I am currently learning to
>program using Turbo Pascal for Windows. Having
>completed the basic tasks with ease, I am looking
>to begin creating programs with a GUI. Items such
>as menus, buttons and dialog boxes are a mystery
>to me and documentation is poor or non-existent.
>Could any of you kind people provide me with (or
>a link to )a guide to using Object Windows and
>resource workshop etc?

>Any help will be gratefully received.

>James Nugent

Yes - the paper documentation for TPW isn't brilliant but the example
programs in the "owldemos" directory on your distribution disks are
really useful. Try adapting some of them to see how things work. That's
how I got to grips with TPW.

--

http://www.ntos.demon.co.uk



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Newbie: Saving DB info when windows closes!!

2. Newbie wants newbie friend

3. Migrating from Windows 95 to Windows 98

4. Windows 3.1 software developed on windows 95

5. Runtime error 200 when running under Windows 95 / Windows NT

6. WINDOWS WINDOWS

7. WINDOWS WINDOWS

8. Detecting Windows from non-Windows program

9. how can I launch a windows program from my windows program

10. Windows calling windows

11. Calling CRT windows as child windows of main window

12. Windows Constants in TP for Windows

 

 
Powered by phpBB® Forum Software