]> git.saurik.com Git - wxWidgets.git/blob - demos/dbbrowse/dlguser.cpp
First version of the DbBrowser demo program
[wxWidgets.git] / demos / dbbrowse / dlguser.cpp
1 //---------------------------------------------------------------------------
2 // Name: DlgUser.h,cpp
3 // Purpose: Dialog mit Variable Gestaltung durch DlgUser.wxr
4 // Author: Mark Johnson, mj10777@gmx.net
5 // Modified by: 19991105.mj10777
6 // Created: 19991105
7 // Copyright: (c) Mark Johnson
8 // Licence: wxWindows license
9 //---------------------------------------------------------------------------
10 //-- all #ifdefs that the whole Project needs. ------------------------------
11 //---------------------------------------------------------------------------
12 #ifdef __GNUG__
13 #pragma implementation
14 #pragma interface
15 #endif
16 //---------------------------------------------------------------------------
17 // For compilers that support precompilation, includes "wx/wx.h".
18 #include "wx/wxprec.h"
19 //---------------------------------------------------------------------------
20 #ifdef __BORLANDC__
21 #pragma hdrstop
22 #endif
23 //---------------------------------------------------------------------------
24 #ifndef WX_PRECOMP
25 #include "wx/wx.h"
26 #endif
27 //---------------------------------------------------------------------------
28 //-- all #includes that every .cpp needs ----19990807.mj10777 ---
29 //---------------------------------------------------------------------------
30 #include "dlguser.h"
31 //---------------------------------------------------------------------------
32 DlgUser::DlgUser(wxWindow *parent, const wxString& title, const wxPoint& pos, const wxSize& size, const long WXUNUSED(style) ) :
33 wxDialog(parent, ID_DIALOG_DSN, title, pos, size, wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL)
34 {
35 SetBackgroundColour("wheat");
36 wxButton *but1 = new wxButton(this, wxID_OK, "OK", wxPoint(55,110), wxSize(80, 30));
37 wxButton *but2 = new wxButton(this, wxID_CANCEL, "Cancel", wxPoint(210,110), wxSize(80, 30));
38 (void)new wxStaticText(this, -1,_("User ID"), wxPoint(20, 40), wxSize(50, 20),wxALIGN_LEFT);
39 (void)new wxStaticText(this, -1,_("Password"), wxPoint(20, 80), wxSize(50, 20),wxALIGN_LEFT);
40 // but1->SetFocus();
41 but1->SetDefault();
42 }
43 void DlgUser::OnInit()
44 {
45 wxString Temp; Temp.Printf(_(">>> %s <<< "),s_DSN.c_str());
46 (void)new wxStaticText(this, -1, Temp, wxPoint(10, 10), wxSize(300, 20),wxALIGN_CENTRE );
47 tc_User = new wxTextCtrl(this, ID_USER, s_User, wxPoint(75, 35), wxSize(200, 25), 0, wxDefaultValidator);
48 tc_Password = new wxTextCtrl(this, ID_PASSWORD, s_Password, wxPoint(75, 75), wxSize(200, 25),wxTE_PASSWORD, wxDefaultValidator);
49 tc_User->SetFocus();
50 }
51 //---------------------------------------------------------------------------
52 BEGIN_EVENT_TABLE(DlgUser, wxDialog)
53 EVT_BUTTON(wxID_OK, DlgUser::OnOk)
54 EVT_BUTTON(wxID_CANCEL, DlgUser::OnCancel)
55 END_EVENT_TABLE()
56 //---------------------------------------------------------------------------
57 void DlgUser::OnOk(wxCommandEvent& WXUNUSED(event) )
58 {
59 canceled = FALSE;
60 s_User = tc_User->GetValue();
61 s_Password = tc_Password->GetValue();
62 EndModal(wxID_OK);
63 }
64 //---------------------------------------------------------------------------
65 void DlgUser::OnCancel(wxCommandEvent& WXUNUSED(event) )
66 {
67 canceled = TRUE;
68 EndModal(wxID_CANCEL);
69 }
70 //---------------------------------------------------------------------------