AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Projekte OOP Dialog-Template based on Windows API dialog resources
Thema durchsuchen
Ansicht
Themen-Optionen

OOP Dialog-Template based on Windows API dialog resources

Ein Thema von Luckie · begonnen am 20. Sep 2007 · letzter Beitrag vom 20. Sep 2007
Antwort Antwort
Benutzerbild von Luckie
Luckie
Registriert seit: 29. Mai 2002
Ich habe mir mal eine nonVCL-Dialog Vorlage erstellt, also quasi so etwas, wie ein Grundgerüst. Ich habe das jetzt mal objekt orientiert programmier nach dem ich so ein Grundgerüst lange Zeit nur prozedural hatte:
Delphi-Quellcode:
type
  TMpuDialog = class(TObject)
  private
    FHandle: THandle;
    FhAccelTbl: THandle;
    FDlgFuncPtr: Pointer;
    FMsg: UINT;
    FwParam: WPARAM;
    FlParam: LPARAM;
    FAppTitle: WideString;
    FhDlgIcon: THandle;
    FLogFont: TLogFont;
    FhBannerFont: THandle;
    function MakeProcInstance(M: TMethod): Pointer;
    function DlgFunc(hDlg: HWND; uMsg: UINT; wParam: WPARAM; lParam: LPARAM): BOOL; stdcall;
    // Getters / Setters
    function GethApp: THandle;
    function GetAppTitle: WideString;
    procedure SetAppTitle(Value: WideString);
    function GetIcon: THandle;
    procedure SetIcon(Value: THandle);
    // Internal methodes
    function Run: Integer;
    procedure SetDlgCaption;
    procedure SetBannerCaption;
    procedure SetDlgIcon;
    // Event handlers
    procedure OnInitDialog(hDlg: HWND; uMsg: UINT; wParam: WPARAM; lParam: LPARAM);
    procedure OnWMSize(wParam: WPARAM; lParam: LPARAM);
    function OnCommad: Boolean;
    procedure OnClose(ExitCode: Integer = 0);
  public
    constructor Create;
    destructor Destroy; override;
    property Handle: THandle read GethApp;
    property AppTitle: WideString read GetAppTitle write SetAppTitle;
    property Icon: THandle read GetIcon write SetIcon;
  end;
Und ein Auszug aus der Readme:
Code:
                                                         Applies to version: 1.0
                                                                Date: 2007-09-06


                         OOPDialog Readme file
                         =====================

  1. What is it?
  --------------
    OOPDialog is a Delphi object orientated Dialog-Template based on Windows API
    Dialog resources.


  2. Archive content and directory structure
  ------------------------------------------

  [..]


  3. How to use
  -------------
    3.1 Prearrangements
      Resource file: Main dialog ID = 100.
                     Accelerator table ID = 4001.
                     Needed version information for the about dialog:
             FileVersion, FileDescription, Legal copyright,
             ProductName, Productversion.
                     Main icon ID = 1.

                     To compile the resource script use resbuild.bat.

      make.bat: If you want to use make.bat, make sure it can find the program
                rcstamp.exe for automatically increment the build number.
                rcstamp: [url]http://www.codeproject.com/tools/rcstamp.asp[/url]

                The binary gets automatically packed bei UPX. Make sure make.bat
                can find upx.exe.

    3.2 Constants
      The tooltips array must contain the tooltip strings in the same order in
      which they are assigned to the corresponding controls, because they get
      assigned with a for-loop. See method OnInitDialog for details.

    3.3 Using the template
      Just adjust the personal settings (icon, productname, ...) in the resource
      script, edit the dialog (add / remove controls) and add your own code.


  4. How it works
  ---------------
    For details see:
    [url]http://www.michael-puff.de/Developer/Artikel/2007_08/[/url] ->
      2007_08_02_CallbackMethod.php


                                                      Copyright (c) Michael Puff
                                                      [url]http://www.michael-puff.de[/url]
Eventuell kann ja jemand etwas damit anfangen oder hat Verbesserungsvorschläge. Einen hätte ich schon selber und zwar die Klasse "rausziehen" und eine neue Dialog-Klasse ableiten. Aber das habe ich noch nicht umgesetzt.
Angehängte Dateien
Dateityp: zip oopdialog_164.zip (181,9 KB, 31x aufgerufen)
Ein Teil meines Codes würde euch verunsichern.
 
Dezipaitor

 
Delphi 7 Professional
 
#2
  Alt 20. Sep 2007, 13:27
Warum machst du nicht richtig OOP und lässt die Klasse überschreiben.
So kann man bestimmte Methoden überschreiben, um z.B. auf Commands zu reagieren.
So müsste man die Klasse jedesmal kopieren und Fehler müssten durch alle Kopien korrigiert werden.

Ich denke da z.B. an Turbo Vision oder Borland Pascal for Windows Stil.
Um ein Fenster zu überschreiben musste man bestimmte Methoden überschreiben.
Christian
  Mit Zitat antworten Zitat
Benutzerbild von Luckie
Luckie

 
Delphi 2006 Professional
 
#3
  Alt 20. Sep 2007, 14:22
Ich sagte ja, das wäre dann der nächste Schritt.
Michael
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 23:09 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz