🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
13 messages
13 total messages Started by Dan Mayo Wed, 07 Feb 2007 15:29
Modifying the TOpenDialog or TSaveDialog
#2625
Author: Dan Mayo
Date: Wed, 07 Feb 2007 15:29
3 lines
1049 bytes
I would like to modify the file save as dialog so that when I double 
click on the file name edit box, rename file or directory, that I can 
pop-up a keyboard.  Is there a way to do this?
Re: Modifying the TOpenDialog or TSaveDialog
#2495
Author: Bruce Larrabee
Date: Thu, 08 Feb 2007 09:29
12 lines
1410 bytes
    Hello Dan,

    I believe this can be accomplished via the registry.
    I'm not certain but I believe that the actions involved
    in this context are the same as those that occur when
    you do the same thing in windows explorer. I think that
    you can trap this action and process the actions you describe...

    HTH?

    Bruce Larrabee
Re: Modifying the TOpenDialog or TSaveDialog
#2516
Author: Dan Mayo
Date: Fri, 09 Feb 2007 16:28
11 lines
1638 bytes
>    I believe this can be accomplished via the registry.

Any idea where I can find a reference or an example for this?

I dread attempting to rewrite the functionality provided by TOpenDialog 
or TSaveDialog; I would think creating a descendant class from one of 
those would be easy, and then adding a TButton to popup a keyboard, or 
capturing the double-click message wouldn't be that hard; but I'm not 
having too much luck.

Is what I am trying to do possible?
Re: Modifying the TOpenDialog or TSaveDialog
#2521
Author: Remy Lebeau (TeamB)
Date: Fri, 09 Feb 2007 18:56
20 lines
1635 bytes
"Dan Mayo" <do_not_spam_dmayo2@netzero.com> wrote in message
news:45cca151$1@newsgroups.borland.com...

> I would think creating a descendant class from one of those
> would be easy, and then adding a TButton to popup a keyboard

Yes, that is doable.  In the OnShow event, you have access to the HWND
of the dialog.  You can use the Win32 API to add/modify anything in
that HWND as desired.  You can even create VCL controls.  Simply set
their ParentWindow property to the HWND of the dialog.

> or capturing the double-click message

Again, using the OnShow event, you can use Get/SetWindowLong() to
subclass the HWND of the edit box so that you can intercept the
WM_LBUTTONDBLCLK message directly.


Gambit
Re: Modifying the TOpenDialog or TSaveDialog
#2523
Author: Dan Mayo
Date: Fri, 09 Feb 2007 18:58
39 lines
2400 bytes
Dan Mayo wrote:
>>    I believe this can be accomplished via the registry.
> 
> Any idea where I can find a reference or an example for this?
> 
> I dread attempting to rewrite the functionality provided by TOpenDialog 
> or TSaveDialog; I would think creating a descendant class from one of 
> those would be easy, and then adding a TButton to popup a keyboard, or 
> capturing the double-click message wouldn't be that hard; but I'm not 
> having too much luck.
> 
> Is what I am trying to do possible?


Reading the Help file, it looks like I can get the Handle for the 
TOpenDialog in the OnShow event.  I was thinking that if I had the 
handle, then I could create a button and add a button to that dialog, 
such as the following:

//OnShow()....
    Button->Top = 0;
    Button->Height = 10;
    Button->Left = 0;
    Button->Width = 10;
    Button->Caption = "HELLO";
    Button->Parent = NULL;

/* <- This places it on the main form, but obviously is inaccessible as 
the dialog is modal during execute()*/
    //Button->Parent = Application->MainForm;


    Button->ParentWindow = this->Handle; //I figure this would do it, 
but it doesn't
    Button->Visible = true;
    Button->BringToFront();


Any ideas?  Or am I barking up the wrong tree again?
Re: Modifying the TOpenDialog or TSaveDialog
#2529
Author: Dan Mayo
Date: Fri, 09 Feb 2007 21:17
25 lines
1750 bytes
Why doesn't the below code show the EditBox in the SaveDialog on the 
OnShowEvent?

    Edit1->Parent = NULL;
    Edit1->ParentWindow = NULL;
    Edit1->ParentWindow = OpenDialog1->Handle;
    Edit1->Top = 0;
    Edit1->Height = 1000;
    Edit1->Left = 0;
    Edit1->Width = 1000;
    Edit1->Text = "HELLO";

    Edit1->Visible = true;
    Edit1->BringToFront();
    Edit1->Refresh();
    Edit1->Repaint();


If I have Edit1 on the main form, Button1 calls the 
SaveDialog->Execute(), when Button1 is clicked, the above code runs (as 
I can see from both breakpoint watching and noticing Edit1 disappear 
from the mainform), but the Edit1 Box is no where to be seen on the 
SaveDialog box.

What is wrong?
Re: Modifying the TOpenDialog or TSaveDialog
#2530
Author: Dan Mayo
Date: Fri, 09 Feb 2007 21:25
2 lines
1201 bytes
Nevermind, I have to use the GetWindowLong...
that works.  Thanks!
Re: Modifying the TOpenDialog or TSaveDialog
#2534
Author: Remy Lebeau (TeamB)
Date: Fri, 09 Feb 2007 23:18
30 lines
2002 bytes
"Dan Mayo" <do_not_spam_dmayo2@netzero.com> wrote in message
news:45ccc478$1@newsgroups.borland.com...

> Reading the Help file, it looks like I can get the Handle for the
> TOpenDialog in the OnShow event.

You can.  What the help does not tell you, however, is that you need
to use the Win32 API GetParent() function to get the *corrent* HWND to
use from the dialog's Handle property.

> I was thinking that if I had the handle, then I could create a
button
> and add a button to that dialog

You can.

>     Button->ParentWindow = this->Handle; //I figure this would do
it,
> but it doesn't

That is the wrong Handle to use.  The event handler is a member of
your TForm class, so the 'this' pointer will point to the instance of
your TForm.  Thus, you are using the TForm's HWND as the parent window
instead of the dialog's HWND.  You need to use this instead:

    Button->ParentWindow = ::GetParent(SaveDialog1->Handle);


Gambit
Re: Modifying the TOpenDialog or TSaveDialog
#2533
Author: Remy Lebeau (TeamB)
Date: Fri, 09 Feb 2007 23:19
12 lines
1330 bytes
"Dan Mayo" <do_not_spam_dmayo2@netzero.com> wrote in message
news:45cce52f@newsgroups.borland.com...

> Why doesn't the below code show the EditBox in the SaveDialog
> on the OnShowEvent?

Because you are still using the wrong HWND as the ParentWindow.  See
my other reply.


Gambit
Re: Modifying the TOpenDialog or TSaveDialog
#2535
Author: Dan Mayo
Date: Sun, 11 Feb 2007 23:39
5 lines
1298 bytes
Ok, button is added, the onclick event is assigned to the button; but 
the onclick event never is fired when the button is clicked?  Why not?

What is the best way to modify the file name editbox when the 
TOpenDialog is already visible?
Re: Modifying the TOpenDialog or TSaveDialog
#2536
Author: Remy Lebeau (TeamB)
Date: Mon, 12 Feb 2007 03:01
26 lines
2053 bytes
"Dan Mayo" <do_not_spam_dmayo2@netzero.com> wrote in message
news:45cfa974$1@newsgroups.borland.com...

> Ok, button is added, the onclick event is assigned to the button;
but
> the onclick event never is fired when the button is clicked?  Why
not?

Because the dialog window is not a VCL window.  It is not designed to
forward the messages that are needed for triggering the button's event
handlers.  You will have to use Get/SetWindowLong() to subclass the
dialog's window in order to handle the WM_COMMAND/BN_CLICKED
notification directly.  Otherwise, put the TButton onto a TPanel or
other container, and then put that onto the dialog window.

> What is the best way to modify the file name editbox when the
> TOpenDialog is already visible?

You already know how to obtain the HWND of the dialog window.  Once
you have that, you can do whatever you want with it and its child
windows.  All you need is their HWNDs as well, which you can get using
FindWindow/Ex() or GetDlgItem().


Gambit
Re: Modifying the TOpenDialog or TSaveDialog
#2545
Author: Dan Mayo
Date: Mon, 12 Feb 2007 15:53
6 lines
1589 bytes
Thank you; I got it completely working now.  It took me a while to find 
the right ID for the edit box since I was trying to browse 
documentation/web to find the appropriate constant; what is the best 
way?  I basically ended up making a loop to get window text from 
incrementing IDs, and then displayed the ID and the text, if found; from 
that I could correlate the ID to the editbox.
Re: Modifying the TOpenDialog or TSaveDialog
#2547
Author: Remy Lebeau (TeamB)
Date: Mon, 12 Feb 2007 17:55
12 lines
1494 bytes
"Dan Mayo" <do_not_spam_dmayo2@netzero.com> wrote in message
news:45d08da4$1@newsgroups.borland.com...

> It took me a while to find the right ID for the edit box since I
> was trying to browse documentation/web to find the appropriate
> constant; what is the best way?

Use Microsoft's Spy++ or Borland's WinSight utilities.


Gambit
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads