Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > C++ Programming
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 18th, 2005, 06:49 PM
Authorized User
 
Join Date: Dec 2005
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default Delphi to C++ conversion. Need help...

Hi all,

I have a program written using Delphi?

Was wondering if anyone had any idea how to convert it to C++,
Thanks alot guys...

Regards
Nicolas

Reply With Quote
  #2 (permalink)  
Old December 18th, 2005, 07:05 PM
Authorized User
 
Join Date: Dec 2005
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This is the program i need to convert to C++...


unit MainU;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs,UsersU,BooksU, IssueU,StdCtrls, ComCtrls;


type
  TForm1 = class(TForm)
    PageControl1: TPageControl;
    TabSheet1: TTabSheet;
    Label1: TLabel;
    PageControl3: TPageControl;
    TabSheet3: TTabSheet;
    issueListbox: TListBox;
    Label2: TLabel;
    ReturnBtn: TButton;
    issueBtn: TButton;
    Button1: TButton;
    UserCombo: TComboBox;
    Label3: TLabel;
    Label4: TLabel;
    BookCombo: TComboBox;
    TabSheet2: TTabSheet;
    PageControl2: TPageControl;
    TabSheet4: TTabSheet;
    SearchListBox: TListBox;
    Label5: TLabel;
    AuthorEdit: TEdit;
    SearchBtn: TButton;
    Label6: TLabel;
    Button2: TButton;
    procedure FormCreate(Sender: TObject);
    procedure TabSheet1Show(Sender: TObject);
    procedure TabSheet2Show(Sender: TObject);
    procedure issueListboxClick(Sender: TObject);
    procedure issueBtnClick(Sender: TObject);
    procedure TabSheet3Show(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure ReturnBtnClick(Sender: TObject);
    procedure UserComboChange(Sender: TObject);
    procedure SearchBtnClick(Sender: TObject);
    procedure AuthorEditChange(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
    fUsers : TUsers;
    fBooks : TBooks;
    fIssue : TIssue;
  public
    { Public declarations }
    procedure refresh;
    procedure resetAll;
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

// initialse variables
procedure TForm1.FormCreate(Sender: TObject);
begin
   fUsers := TUsers.create;
   fBooks := TBooks.create;
   fIssue := TIssue.create;
   // load users and books lists
   fUsers.loadUsers;
   fBooks.loadBooks;
end;


procedure TForm1.TabSheet1Show(Sender: TObject);
begin
   refresh;
end;

procedure TForm1.TabSheet2Show(Sender: TObject);
begin
   refresh;
end;

procedure TForm1.TabSheet3Show(Sender: TObject);
begin
   refresh;
end;

procedure TForm1.UserComboChange(Sender: TObject);
begin
   // if book and user selected then enable th issue button
   if (UserCombo.ItemIndex > 0) and
      (BookCombo.ItemIndex > 0) then
       issueBtn.Enabled := true
   else
       issueBtn.Enabled := false;
end;


procedure TForm1.issueListboxClick(Sender: TObject);
begin
   // if issued book selected then enable the retrun button
   if issueListbox.ItemIndex > 0 then
      ReturnBtn.Enabled := true
   else
      ReturnBtn.Enabled := false;
end;

procedure TForm1.issueBtnClick(Sender: TObject);
var tempUser:Tuser;
    tempBook:TBook;
begin
   if (BookCombo.ItemIndex <> -1) and
      (UserCombo.ItemIndex <> -1) then
   begin
      if (UserCombo.ItemIndex <> 0) and
         (BookCombo.ItemIndex <> 0) then
      begin
         tempUser := fUsers.getUserAt(UserCombo.ItemIndex-1);
         tempBook := fBooks.getBookAt(BookCombo.ItemIndex-1);
         fIssue.issueBook(tempUser,tempBook);
         refresh;
      end
      else
         MessageDlg('Invalid item chosen. First record is not user/book.',mtError,[mbok],0);
   end;
end;

procedure TForm1.ReturnBtnClick(Sender: TObject);
var tempissueItem:TIssueItem;
begin
    if (issueListbox.ItemIndex > 0) then
    begin
       tempissueItem := fIssue.getItemAt(issueListbox.ItemIndex-1);
       fIssue.returnBook(tempissueItem.getUser,tempissueI tem.getBook);
       refresh;
    end
    else
       MessageDlg('Invalid item chosen. First record is not user/book.',mtError,[mbok],0);
end;



procedure TForm1.refresh;
begin
   UserCombo.Items.Text := fUsers.toString;
   BookCombo.Items.Text := fBooks.toString;
   issueListbox.Items.Text := fIssue.toString;
   resetAll;
end;

procedure TForm1.resetAll;
begin
   UserCombo.ItemIndex := -1;
   BookCombo.ItemIndex := -1;
   issueListbox.ItemIndex := -1;
   UserComboChange(nil);
   issueListboxClick(nil);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
   refresh;
end;


procedure TForm1.SearchBtnClick(Sender: TObject);
var tempStr:String;
begin
   tempStr := fbooks.findBook(trim(AuthorEdit.Text));
   SearchListBox.Items.Text := tempStr;
   MessageDlg(inttostr(SearchListBox.count)+' match(es) found.',mtInformation,[mbok],0);
end;

procedure TForm1.AuthorEditChange(Sender: TObject);
begin
   if trim(AuthorEdit.Text)<>'' then
      SearchBtn.Enabled := true
   else
      SearchBtn.Enabled := false;

end;

procedure TForm1.Button2Click(Sender: TObject);
begin
   AuthorEdit.Clear;
   SearchListBox.Clear;
end;

end.

Any help would be appreciated. thanks again...

Ragards
Nicolas

Reply With Quote
  #3 (permalink)  
Old December 20th, 2005, 01:51 AM
Authorized User
 
Join Date: Nov 2005
Location: , , India.
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Don't know anything about Delphi...but did a google search and came across this link which may be useful
http://www.softempire.com/delphi-to-c-builder.html

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delphi coder transitioning to VS 2005 BabyToy VB Databases Basics 0 June 11th, 2007 06:17 AM
Controlling Speaker with Borland Delphi 6.0 Randhy Other Programming Languages 0 April 1st, 2006 08:02 AM
AWSExpert for Builder/Delphi 5-6-7 sash2 C++ Programming 0 January 26th, 2005 10:15 AM
How to call a Delphi DLL in ASP Geo Classic ASP Basics 1 April 23rd, 2004 03:14 AM
Delphi ADO Query acabrera Oracle 2 February 2nd, 2004 12:49 PM



All times are GMT -4. The time now is 06:52 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.