]>
git.saurik.com Git - wxWidgets.git/blob - demos/dbbrowse/dlguser.cpp
1 //---------------------------------------------------------------------------
3 // Purpose: Dialog mit Variable Gestaltung durch DlgUser.wxr
4 // Author: Mark Johnson, mj10777@gmx.net
5 // Modified by: 19991105.mj10777
7 // Copyright: (c) Mark Johnson
8 // Licence: wxWindows license
10 //---------------------------------------------------------------------------
11 //-- all #ifdefs that the whole Project needs. ------------------------------
12 //---------------------------------------------------------------------------
14 #pragma implementation
17 //---------------------------------------------------------------------------
18 // For compilers that support precompilation, includes "wx/wx.h".
19 #include "wx/wxprec.h"
20 //---------------------------------------------------------------------------
24 //---------------------------------------------------------------------------
28 //---------------------------------------------------------------------------
29 //-- all #includes that every .cpp needs ----19990807.mj10777 ---
30 //---------------------------------------------------------------------------
32 //---------------------------------------------------------------------------
33 DlgUser::DlgUser(wxWindow
*parent
, const wxString
& title
) :
34 wxDialog(parent
, ID_DIALOG_DSN
, title
)
36 SetBackgroundColour("wheat");
38 wxLayoutConstraints
* layout
;
41 // m_Dsn = new wxStaticText(this, -1, "", wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE);
42 // layout = new wxLayoutConstraints;
43 // layout->centreX.SameAs(this, wxCentreX);
44 // layout->top.SameAs(this, wxTop,10);
45 // layout->height.AsIs();
46 // layout->width.AsIs();
47 // m_Dsn->SetConstraints(layout);
49 m_Label1
= new wxStaticText(this, -1, _("User ID:"));
50 layout
= new wxLayoutConstraints
;
51 layout
->left
.SameAs(this, wxLeft
, 10);
52 layout
->top
.SameAs(this, wxTop
, 10);
53 layout
->height
.AsIs();
54 layout
->width
.Absolute(75);
55 m_Label1
->SetConstraints(layout
);
57 m_UserName
= new wxTextCtrl(this, -1, "");
58 layout
= new wxLayoutConstraints
;
59 layout
->left
.SameAs(m_Label1
, wxRight
, 10);
60 // layout->top.SameAs(m_Label1, wxTop);
61 layout
->centreY
.SameAs(m_Label1
,wxCentreY
);
62 layout
->width
.Absolute(200);
63 layout
->height
.AsIs();
64 m_UserName
->SetConstraints(layout
);
67 m_Label2
= new wxStaticText(this, -1, _("Password:"));
68 layout
= new wxLayoutConstraints
;
69 layout
->left
.SameAs(m_Label1
, wxLeft
);
70 layout
->top
.SameAs(m_Label1
, wxBottom
, 10);
71 layout
->height
.AsIs();
72 layout
->width
.SameAs(m_Label1
, wxWidth
);
73 m_Label2
->SetConstraints(layout
);
75 m_Password
= new wxTextCtrl(this, -1, "", wxDefaultPosition
, wxDefaultSize
, wxTE_PASSWORD
);
76 layout
= new wxLayoutConstraints
;
77 layout
->left
.SameAs(m_UserName
, wxLeft
);
78 layout
->width
.SameAs(m_UserName
, wxWidth
);
79 // layout->top.SameAs(m_Label2, wxTop);
80 layout
->centreY
.SameAs(m_Label2
,wxCentreY
);
81 layout
->height
.AsIs();
82 m_Password
->SetConstraints(layout
);
84 m_OK
= new wxButton(this, wxID_OK
, _("Ok"));
85 layout
= new wxLayoutConstraints
;
86 layout
->left
.SameAs(this, wxLeft
, 10);
87 layout
->top
.SameAs(m_Label2
, wxBottom
,10);
88 layout
->height
.AsIs();
89 layout
->width
.Absolute(75);
90 m_OK
->SetConstraints(layout
);
92 m_Cancel
= new wxButton(this, wxID_CANCEL
, _("Cancel"));
93 layout
= new wxLayoutConstraints
;
94 layout
->left
.SameAs(m_OK
, wxRight
, 10);
95 layout
->top
.SameAs(m_OK
, wxTop
);
96 layout
->height
.AsIs();
97 layout
->width
.SameAs(m_OK
, wxWidth
);
98 m_Cancel
->SetConstraints(layout
);
101 m_UserName
->SetFocus();
112 // wxButton *but1 = new wxButton(this, wxID_OK, "OK", wxPoint(55,110), wxSize(80, 30));
113 // wxButton *but2 = new wxButton(this, wxID_CANCEL, "Cancel", wxPoint(210,110), wxSize(80, 30));
114 // (void)new wxStaticText(this, -1,_("User ID"), wxPoint(20, 40), wxSize(50, 20),wxALIGN_LEFT);
115 // (void)new wxStaticText(this, -1,_("Password"), wxPoint(20, 80), wxSize(50, 20),wxALIGN_LEFT);
117 // m_OK->SetDefault();
120 void DlgUser::OnInit()
122 wxString Temp
; Temp
.Printf(_(">>> %s <<< "),s_DSN
.c_str());
125 m_UserName
->SetLabel(s_User
);
126 m_Password
->SetLabel(s_Password
);
128 // (void)new wxStaticText(this, -1, Temp, wxPoint(10, 10), wxSize(300, 20),wxALIGN_CENTRE );
129 // tc_User = new wxTextCtrl(this, ID_USER, s_User, wxPoint(75, 35), wxSize(200, 25), 0, wxDefaultValidator);
130 // tc_Password = new wxTextCtrl(this, ID_PASSWORD, s_Password, wxPoint(75, 75), wxSize(200, 25),wxTE_PASSWORD, wxDefaultValidator);
131 // tc_User->SetFocus();
133 //---------------------------------------------------------------------------
134 BEGIN_EVENT_TABLE(DlgUser
, wxDialog
)
135 EVT_BUTTON(wxID_OK
, DlgUser::OnOk
)
136 EVT_BUTTON(wxID_CANCEL
, DlgUser::OnCancel
)
140 //---------------------------------------------------------------------------
141 void DlgUser::OnOk(wxCommandEvent
& WXUNUSED(event
) )
144 s_User
= m_UserName
->GetValue();
145 s_Password
= m_Password
->GetValue();
148 //---------------------------------------------------------------------------
149 //void DlgUser::OnCancel(wxCommandEvent& WXUNUSED(event) )
152 // EndModal(wxID_CANCEL);
154 //---------------------------------------------------------------------------