Results 1 to 7 of 7

Thread: Stupid Nested Delphi Statements.....[RESOLVED]

  1. #1

    Thread Starter
    Supreme User Madboy's Avatar
    Join Date
    Oct 2003
    Location
    England
    Posts
    3,253

    Stupid Nested Delphi Statements.....[RESOLVED]

    Im in a muddle here, its simple, but frustrating at the best of times. Can anyone see by looking at it any misplaced statements?

    EDIT: The problem is the ShowMessage('TEST') is not been called

    Code:
    procedure TfrmMain.mnuFileOpenClick(Sender: TObject);
    var
      MsgText, MsgCaption: String;
      NL: String;
      MsgType, UserResp: integer;
    begin
      if dlgOpen.Execute then
        if dlgOpen.FilterIndex = 1 {Text Document} then
          if Dirty1 = True then
          begin
            NL := #13 + #10;   {New Lin}
            MsgCaption := 'Super Editor Professional';
            MsgText := MsgText + 'The document has changed, if you open a file the changes will be lost.' + NL;
            MsgText := MsgText + '' + NL;
            MsgText := MsgText + 'Are you sure you want to open a file?';
            MsgType := MB_YESNOCANCEL + MB_ICONQUESTION + MB_DEFBUTTON1 + MB_APPLMODAL;
            UserResp := MessageBox( Handle, PChar(MsgText), PChar(MsgCaption), MsgType);
            Case UserResp of
            IDCANCEL:
            begin
              self.Refresh;
            end;
            IDYES:
            begin
              OpenTextFile;
            end;
            IDNO:
            begin
              self.Refresh;
            end;
          else
            ShowMessage('Test');
          end;
        end;
    end;


    Thanks
    Last edited by Madboy; Jul 4th, 2005 at 08:11 AM.

  2. #2
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: Stupid Nested Delphi Statements.....

    what about
    Code:
    procedure TfrmMain.mnuFileOpenClick(Sender: TObject);
    var
      MsgText, MsgCaption: String;
      NL: String;
      MsgType, UserResp: integer;
    begin
      if dlgOpen.Execute then
        if dlgOpen.FilterIndex = 1 {Text Document} then
          if Dirty1 = True then
          begin
            NL := #13 + #10;   {New Lin}
            MsgCaption := 'Super Editor Professional';
            MsgText := MsgText + 'The document has changed, if you open a file the changes will be lost.' + NL;
            MsgText := MsgText + '' + NL;
            MsgText := MsgText + 'Are you sure you want to open a file?';
            MsgType := MB_YESNOCANCEL + MB_ICONQUESTION + MB_DEFBUTTON1 + MB_APPLMODAL;
            UserResp := MessageBox( Handle, PChar(MsgText), PChar(MsgCaption), MsgType);
            Case UserResp of
            IDCANCEL:
            begin
              self.Refresh;
            end;
            IDYES:
            begin
              OpenTextFile;
            end;
            IDNO:
            begin
              self.Refresh;
            end;
    end;
          else
    begin;
            ShowMessage('Test');
          end;
        end;
    end;
    I don't live here any more.

  3. #3
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: Stupid Nested Delphi Statements.....

    Please post your delphi questions in the Cubase Forum

  4. #4

    Thread Starter
    Supreme User Madboy's Avatar
    Join Date
    Oct 2003
    Location
    England
    Posts
    3,253

    Re: Stupid Nested Delphi Statements.....

    no change, i might try and simplify the code in a seperate procedure then try and call it maybe, keep the nested statements cleaner. Its so SIMPLE, yet easy to get mixed up

  5. #5

    Thread Starter
    Supreme User Madboy's Avatar
    Join Date
    Oct 2003
    Location
    England
    Posts
    3,253

    Re: Stupid Nested Delphi Statements.....

    Got you, you little worm

    Code:
    if dlgOpen.FilterIndex = 1 {Text Document} then
        begin
          if Dirty1 = False then
            OpenTextFile
          else if Dirty1 = True then
          begin
            NL := #13 + #10;
            MsgCaption := 'Super Editor Professional';
            MsgText := MsgText + 'The document has changed, if you open a file the changes will be lost.' + NL;
            MsgText := MsgText + '' + NL;
            MsgText := MsgText + 'Are you sure you want to open this file?';
            MsgType := MB_YESNOCANCEL + MB_ICONQUESTION + MB_DEFBUTTON1 + MB_APPLMODAL;
            UserResp := MessageBox( Handle, PChar(MsgText), PChar(MsgCaption), MsgType);
            Case UserResp of
            IDCANCEL:
            begin
              self.Refresh;
            end;
            IDYES:
            begin
              OpenTextFile;
            end;
            IDNO:
            begin
              self.Refresh
            end
          end;
        end;

  6. #6
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: Stupid Nested Delphi Statements.....[RESOLVED]

    Has anyone seen Delphi.net yet?

  7. #7

    Thread Starter
    Supreme User Madboy's Avatar
    Join Date
    Oct 2003
    Location
    England
    Posts
    3,253

    Re: Stupid Nested Delphi Statements.....[RESOLVED]

    I tested Delphi 2005.NET is that what you mean?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width