Source code of file oscpmwin_v0.4.1.816/askuser.pas from the
osCommerce Product Manager for Windows.
0000: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001: osCommerce Product Manager for Windows (oscpmwin).
0002: Copyright �2003-2006 by Mario A. Valdez-Ramirez.
0003:
0004: You can contact Mario A. Valdez-Ramirez
0005: by email at mario@mariovaldez.org or paper mail at
0006: Olmos 809, San Nicolas, NL. 66495, Mexico.
0007:
0008: This program is free software; you can redistribute it and/or modify
0009: it under the terms of the GNU General Public License as published by
0010: the Free Software Foundation; either version 2 of the License, or (at
0011: your option) any later version.
0012:
0013: This program is distributed in the hope that it will be useful, but
0014: WITHOUT ANY WARRANTY; without even the implied warranty of
0015: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0016: General Public License for more details.
0017:
0018: You should have received a copy of the GNU General Public License
0019: along with this program; if not, write to the Free Software
0020: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0021: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0022: unit askuser;
0023:
0024: interface
0025:
0026: uses
0027: Classes, Controls, Forms, StdCtrls, Buttons;
0028:
0029: type
0030: Topm_Form_AskUser = class(TForm)
0031: opm_Label_AskUserTitle: TLabel;
0032: opm_Edit_AskUserData: TEdit;
0033: opm_BitBtn_AskUserOk: TBitBtn;
0034: opm_BitBtn_AskUserCancel: TBitBtn;
0035: opm_ComboBox_AskUserList: TComboBox;
0036: procedure FormShow(Sender: TObject);
0037: procedure FormCreate(Sender: TObject);
0038: procedure opm_BitBtn_AskUserOkClick(Sender: TObject);
0039: private
0040: public
0041: AU_Title : STRING;
0042: AU_Directions : STRING;
0043: AU_PassChar : CHAR;
0044: AU_MaxLen : LONGINT;
0045: AU_TextOrList : BOOLEAN;
0046: AU_DataText : STRING;
0047: AU_DataList : TStringList;
0048: AU_ListItem : LONGINT;
0049: AU_PreCleanList : BOOLEAN;
0050: AU_DataListText : STRING;
0051: end;
0052:
0053: var
0054: opm_Form_AskUser: Topm_Form_AskUser;
0055:
0056: implementation
0057:
0058: uses gnugettext;
0059:
0060: {$R *.dfm}
0061:
0062:
0063:
0064:
0065: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0066: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0067: procedure Topm_Form_AskUser.FormShow(Sender: TObject);
0068: begin
0069: opm_Form_AskUser.Caption := AU_Title;
0070: opm_Label_AskUserTitle.Caption := AU_Directions;
0071: opm_Edit_AskUserData.Enabled := AU_TextOrList;
0072: opm_Edit_AskUserData.Visible := AU_TextOrList;
0073: opm_ComboBox_AskUserList.Enabled := NOT (AU_TextOrList);
0074: opm_ComboBox_AskUserList.Visible := NOT (AU_TextOrList);
0075: IF (AU_TextOrList = TRUE) THEN
0076: BEGIN
0077: opm_Edit_AskUserData.PasswordChar := AU_PassChar;
0078: opm_Edit_AskUserData.MaxLength := AU_MaxLen;
0079: opm_Edit_AskUserData.Text := AU_DataText;
0080: opm_ComboBox_AskUserList.Items.Clear;
0081: opm_Form_AskUser.FocusControl (opm_Edit_AskUserData);
0082: END
0083: ELSE
0084: BEGIN
0085: opm_Edit_AskUserData.PasswordChar := #0;
0086: opm_Edit_AskUserData.MaxLength := 0;
0087: opm_Edit_AskUserData.Text := '';
0088: IF (AU_DataListText <> '') THEN opm_ComboBox_AskUserList.Items.Text := AU_DataListText ELSE opm_ComboBox_AskUserList.Items := AU_DataList;
0089: IF (AU_PreCleanList = TRUE) THEN
0090: BEGIN
0091: IF (opm_ComboBox_AskUserList.Items.Count > 0) THEN opm_ComboBox_AskUserList.Items.Delete (0);
0092: IF (opm_ComboBox_AskUserList.Items.Count > 0) THEN opm_ComboBox_AskUserList.Items.Delete (opm_ComboBox_AskUserList.Items.Count - 1);
0093: END;
0094: opm_ComboBox_AskUserList.ItemIndex := AU_ListItem;
0095: opm_Form_AskUser.FocusControl (opm_ComboBox_AskUserList);
0096: END;
0097: end;
0098:
0099:
0100: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0101: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0102: procedure Topm_Form_AskUser.FormCreate(Sender: TObject);
0103: begin
0104: AU_Title := '';
0105: AU_Directions := '';
0106: AU_PassChar := #0;
0107: AU_MaxLen := 0;
0108: AU_TextOrList := FALSE;
0109: AU_DataText := '';
0110: AU_ListItem := 0;
0111: AU_PreCleanList := FALSE;
0112: AU_DataListText := '';
0113: TranslateComponent (self);
0114: end;
0115:
0116:
0117: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0118: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0119: procedure Topm_Form_AskUser.opm_BitBtn_AskUserOkClick(Sender: TObject);
0120: begin
0121: AU_Title := '';
0122: AU_Directions := '';
0123: AU_PassChar := #0;
0124: AU_MaxLen := 0;
0125: AU_PreCleanList := FALSE;
0126: AU_DataListText := '';
0127: IF (AU_TextOrList = TRUE) THEN
0128: BEGIN
0129: AU_DataText := opm_Edit_AskUserData.Text;
0130: AU_ListItem := -1;
0131: END
0132: ELSE
0133: BEGIN
0134: AU_DataText := opm_ComboBox_AskUserList.Text;
0135: AU_ListItem := opm_ComboBox_AskUserList.ItemIndex;
0136: END;
0137: end;
0138:
0139:
0140:
0141:
0142: end.