Page 1 of 1

Custom connect dialog does not save Server/username

Posted: Mon 20 Sep 2010 09:40
by pterblan
I've implemented my own themed connect dialog in Builder 2010. It works fine but does not store the previous successful server or user names. It does list the servers stored by TMyConnectDialog (if I switch to TMyConnectDialog and then back to my custom one).

I noticed that the SaveServerListToRegistry() call is protected in DBAccess.hpp. Is this what TMyConnectDialog uses? How do I access it?

Thanks
Piet

Posted: Wed 22 Sep 2010 09:39
by Dimon
You can use your own connection form, but you should use it with TCustomConnectDialog or its descendant. In this case you can use the functionality of TCustomConnectDialog. To save connection options set the TCustomConnectDialog.StoreLogInfo property to True.
You can look at the example of using custom connection dialog in the ConnectDialog demo of MyDACDemo.

Posted: Thu 30 Sep 2010 11:48
by pterblan
I followed the example and use my own dialog with TCustomConnectDialog. I also set the StoreLogInfo property to true, but that only worked when I used TMyConnectDialog directly. The problem appears to be that my connection dialog would read info previously stored by TMyConnectDialog, but not add any new info. Everything else works well.

Posted: Mon 04 Oct 2010 13:50
by Dimon
Please try to compose a small sample to demonstrate the problem and send it to dmitryg*devart*com.

Posted: Wed 20 Oct 2010 11:55
by pterblan
Any luck with my sample app?

Posted: Tue 26 Oct 2010 11:39
by Dimon
To solve the problem add the ConnectDialog published property to the TConnectDlg class, like this:

Code: Select all

__published:
  __property TMyConnectDialog* ConnectDialog = {read=FConnectDialog, write=SetConnectDialog};
To connect to MySQL server use the following code instead of your code in the bConnectClick method:

Code: Select all

  RegisterClass(__classid(TConnectDlg));
  DMod->MyConnection->ConnectDialog->DialogClass = "TConnectDlg";
  DMod->MyConnection->Connect();

Posted: Tue 26 Oct 2010 12:47
by pterblan
Great! Everything now works exactly as I wanted it to.
Thanks again for excellent support.