🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #13040

Re: Want to change position of standard dialogs

#13040
From: Rodolfo Frino
Date: Fri, 31 Oct 2003 06:07
96 lines
3958 bytes
I used it because Borland uses too. Haver a look at this example in the
Builder's help:
OpenPictureDialog, TApplication::Icon Example

However, I replaced that line with the one that you posted
    OpenDialog1->Options =  TOpenOptions();            // Statement 1

The first dialog is not shown because of two things

1-  In the OpenDialog1Show event handler the dimensions of the first dialog
are zero

     MoveWindow(H, 0, 0, 0, 0, false);

2- If we don't use the Statement 1, we will see the title bar of the first
dialog (with no dialog's client area
because the dimensions are 0). So we clear the options to remove the menu
bar. However, I
did not investigate any further as to see why.

As a result I can only see one dialog box, the one corresponding to the call
in
the OpenDialog1SelectionChange event handler.

MoveWindow(H, 0, 0, 800, 300, true);

The only thing that I noticed is a small flickering of the Parent form (The
one that contaoins the BitBtn)
immediatly before the creation of the Dialog which I think is negligible
(althogh you might think it isn't)

Please, run the program and you will see that there is only one dialog
visible.

TForm1 *Form1;
TOpenDialog* OpenDialog1;
String DlgTitle;
HWND H;

//--------------------------------------------------------------------------
-
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
    //CREATE OPENDIALOG  --------------------------------------------
    OpenDialog1  = new TOpenDialog(this);
    OpenDialog1->Title = "This is the Title";
    DlgTitle = OpenDialog1->Title;
    OpenDialog1->OnShow = OpenDialog1Show;
    OpenDialog1->OnSelectionChange = OpenDialog1SelectionChange;
    OpenDialog1->Options =  TOpenOptions();  //<<================== Replaced

}
//--------------------------------------------------------------------------
-

void __fastcall TForm1::BitBtn1Click(TObject *Sender)
{
    OpenDialog1->FileName = "doc.c";

    if (OpenDialog1->Execute())
    {
        // Place your code here
    }
}
//--------------------------------------------------------------------------
-

void __fastcall TForm1::OpenDialog1Show(TObject *Sender)
{
      H = FindWindow(NULL, DlgTitle.c_str());
      MoveWindow(H, 0, 0, 0, 0, false);      //<<==== Notice NILL dimensions
}
//--------------------------------------------------------------------------
-

void __fastcall TForm1::OpenDialog1SelectionChange(TObject *Sender)
{
    MoveWindow(H, 0, 0, 800, 300, true);  //<<==== Wanted dimensions
}
//--------------------------------------------------------------------------
-

void __fastcall TForm1::BitBtn2Click(TObject *Sender)
{
//
    OpenDialog2->FileName = "doc.c";

    if (OpenDialog2->Execute())
    {
        // Place your code here
    }
}


Rodolfo
Technical Details
Message-ID: <3fa1fc23$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3FA01311.62845116@uni-trier.de> <3fa19d6a@newsgroups.borland.com> <3fa1a188$1@newsgroups.borland.com> <3fa1b607$1@newsgroups.borland.com> <3fa1d558@newsgroups.borland.com> <3fa1f406@newsgroups.borland.com> <3fa1f692$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,5023092a61a6c0b9
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-10-30 22:09:04 PST
From: "Rodolfo Frino" <rodolfowrvxg527u7qfrino@yahoo.com.jki>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3FA01311.62845116@uni-trier.de> <3fa19d6a@newsgroups.borland.com> <3fa1a188$1@newsgroups.borland.com> <3fa1b607$1@newsgroups.borland.com> <3fa1d558@newsgroups.borland.com> <3fa1f406@newsgroups.borland.com> <3fa1f692$1@newsgroups.borland.com>
Subject: Re: Want to change position of standard dialogs
Date: Fri, 31 Oct 2003 17:07:51 +1100
Lines: 98
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 203.206.17.146
Message-ID: <3fa1fc23$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1067580451 203.206.17.146 (30 Oct 2003 22:07:31 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail