]>
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_Label1
= new wxStaticText(this, -1, _("User ID:"));
42 layout
= new wxLayoutConstraints
;
43 layout
->left
.SameAs(this, wxLeft
, 10);
44 layout
->top
.SameAs(this, wxTop
, 10);
45 layout
->height
.AsIs();
46 layout
->width
.Absolute(75);
47 m_Label1
->SetConstraints(layout
);
49 m_UserName
= new wxTextCtrl(this, -1, "");
50 layout
= new wxLayoutConstraints
;
51 layout
->left
.SameAs(m_Label1
, wxRight
, 10);
52 // layout->top.SameAs(m_Label1, wxTop);
53 layout
->centreY
.SameAs(m_Label1
,wxCentreY
);
54 layout
->width
.Absolute(200);
55 layout
->height
.AsIs();
56 m_UserName
->SetConstraints(layout
);
59 m_Label2
= new wxStaticText(this, -1, _("Password:"));
60 layout
= new wxLayoutConstraints
;
61 layout
->left
.SameAs(m_Label1
, wxLeft
);
62 layout
->top
.SameAs(m_Label1
, wxBottom
, 10);
63 layout
->height
.AsIs();
64 layout
->width
.SameAs(m_Label1
, wxWidth
);
65 m_Label2
->SetConstraints(layout
);
67 m_Password
= new wxTextCtrl(this, -1, "", wxDefaultPosition
, wxDefaultSize
, wxTE_PASSWORD
);
68 layout
= new wxLayoutConstraints
;
69 layout
->left
.SameAs(m_UserName
, wxLeft
);
70 layout
->width
.SameAs(m_UserName
, wxWidth
);
71 // layout->top.SameAs(m_Label2, wxTop);
72 layout
->centreY
.SameAs(m_Label2
,wxCentreY
);
73 layout
->height
.AsIs();
74 m_Password
->SetConstraints(layout
);
76 m_OK
= new wxButton(this, wxID_OK
, _("OK"));
77 layout
= new wxLayoutConstraints
;
78 layout
->left
.SameAs(this, wxLeft
, 10);
79 layout
->top
.SameAs(m_Label2
, wxBottom
,10);
80 layout
->height
.AsIs();
81 layout
->width
.Absolute(75);
82 m_OK
->SetConstraints(layout
);
84 m_Cancel
= new wxButton(this, wxID_CANCEL
, _("Cancel"));
85 layout
= new wxLayoutConstraints
;
86 layout
->left
.SameAs(m_OK
, wxRight
, 10);
87 layout
->top
.SameAs(m_OK
, wxTop
);
88 layout
->height
.AsIs();
89 layout
->width
.SameAs(m_OK
, wxWidth
);
90 m_Cancel
->SetConstraints(layout
);
93 m_UserName
->SetFocus();
99 //----------------------------------------------------------------------------------------
100 void DlgUser::OnInit()
102 wxString Temp
; Temp
.Printf(_(">>> %s <<<"),s_DSN
.c_str());
104 m_UserName
->SetLabel(s_User
);
105 m_Password
->SetLabel(s_Password
);
106 m_Label1
->SetFont(* pDoc
->ft_Doc
); m_Label2
->SetFont(* pDoc
->ft_Doc
);
107 m_UserName
->SetFont(* pDoc
->ft_Doc
); m_Password
->SetFont(* pDoc
->ft_Doc
);
108 m_OK
->SetFont(* pDoc
->ft_Doc
); m_Cancel
->SetFont(* pDoc
->ft_Doc
);
110 //----------------------------------------------------------------------------------------
111 BEGIN_EVENT_TABLE(DlgUser
, wxDialog
)
112 EVT_BUTTON(wxID_OK
, DlgUser::OnOk
)
113 EVT_BUTTON(wxID_CANCEL
, DlgUser::OnCancel
)
115 //----------------------------------------------------------------------------------------
116 void DlgUser::OnOk(wxCommandEvent
& WXUNUSED(event
) )
119 s_User
= m_UserName
->GetValue();
120 s_Password
= m_Password
->GetValue();
123 //----------------------------------------------------------------------------------------
124 //void DlgUser::OnCancel(wxCommandEvent& WXUNUSED(event) )
127 // EndModal(wxID_CANCEL);
129 //----------------------------------------------------------------------------------------