Source code of file oscpmwin_v0.4.1.642/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: Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
0028: Dialogs, StdCtrls, Buttons;
0029:
0030: type
0031: Topm_Form_AskUser = class(TForm)
0032: opm_Label_AskUserTitle: TLabel;
0033: opm_Edit_AskUserData: TEdit;
0034: opm_BitBtn_AskUserOk: TBitBtn;
0035: opm_BitBtn_AskUserCancel: TBitBtn;
0036: opm_ComboBox_AskUserList: TComboBox;
0037: procedure FormShow(Sender: TObject);
0038: procedure FormCreate(Sender: TObject);
0039: procedure opm_BitBtn_AskUserOkClick(Sender: TObject);
0040: private
0041: public
0042: AU_Title : STRING;
0043: AU_Directions : STRING;
0044: AU_PassChar : CHAR;
0045: AU_MaxLen : LONGINT;
0046: AU_TextOrList : BOOLEAN;
0047: AU_DataText : STRING;
0048: AU_DataList : TStringList;
0049: AU_ListItem : LONGINT;
0050: AU_PreCleanList : BOOLEAN;
0051: AU_DataListText : STRING;
0052: end;
0053:
0054: var
0055: opm_Form_AskUser: Topm_Form_AskUser;
0056:
0057: implementation
0058:
0059: uses gnugettext, main, oscpmdata, balloons;
0060:
0061: {$R *.dfm}
0062:
0063:
0064:
0065:
0066: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0067: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0068: procedure Topm_Form_AskUser.FormShow(Sender: TObject);
0069: begin
0070: opm_Form_AskUser.Caption := AU_Title;
0071: opm_Label_AskUserTitle.Caption := AU_Directions;
0072: opm_Edit_AskUserData.Enabled := AU_TextOrList;
0073: opm_Edit_AskUserData.Visible := AU_TextOrList;
0074: opm_ComboBox_AskUserList.Enabled := NOT (AU_TextOrList);
0075: opm_ComboBox_AskUserList.Visible := NOT (AU_TextOrList);
0076: IF (AU_TextOrList = TRUE) THEN
0077: BEGIN
0078: opm_Edit_AskUserData.PasswordChar := AU_PassChar;
0079: opm_Edit_AskUserData.MaxLength := AU_MaxLen;
0080: opm_Edit_AskUserData.Text := AU_DataText;
0081: opm_ComboBox_AskUserList.Items.Clear;
0082: opm_Form_AskUser.FocusControl (opm_Edit_AskUserData);
0083: END
0084: ELSE
0085: BEGIN
0086: opm_Edit_AskUserData.PasswordChar := #0;
0087: opm_Edit_AskUserData.MaxLength := 0;
0088: opm_Edit_AskUserData.Text := '';
0089: IF (AU_DataListText <> '') THEN opm_ComboBox_AskUserList.Items.Text := AU_DataListText ELSE opm_ComboBox_AskUserList.Items := AU_DataList;
0090: IF (AU_PreCleanList = TRUE) THEN
0091: BEGIN
0092: IF (opm_ComboBox_AskUserList.Items.Count > 0) THEN opm_ComboBox_AskUserList.Items.Delete (0);
0093: IF (opm_ComboBox_AskUserList.Items.Count > 0) THEN opm_ComboBox_AskUserList.Items.Delete (opm_ComboBox_AskUserList.Items.Count - 1);
0094: END;
0095: opm_ComboBox_AskUserList.ItemIndex := AU_ListItem;
0096: opm_Form_AskUser.FocusControl (opm_ComboBox_AskUserList);
0097: END;
0098: end;
0099:
0100:
0101: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0102: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0103: procedure Topm_Form_AskUser.FormCreate(Sender: TObject);
0104: begin
0105: AU_Title := '';
0106: AU_Directions := '';
0107: AU_PassChar := #0;
0108: AU_MaxLen := 0;
0109: AU_TextOrList := FALSE;
0110: AU_DataText := '';
0111: AU_ListItem := 0;
0112: AU_PreCleanList := FALSE;
0113: AU_DataListText := '';
0114: TranslateComponent (self);
0115: end;
0116:
0117:
0118: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0119: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0120: procedure Topm_Form_AskUser.opm_BitBtn_AskUserOkClick(Sender: TObject);
0121: begin
0122: AU_Title := '';
0123: AU_Directions := '';
0124: AU_PassChar := #0;
0125: AU_MaxLen := 0;
0126: AU_PreCleanList := FALSE;
0127: AU_DataListText := '';
0128: IF (AU_TextOrList = TRUE) THEN
0129: BEGIN
0130: AU_DataText := opm_Edit_AskUserData.Text;
0131: AU_ListItem := -1;
0132: END
0133: ELSE
0134: BEGIN
0135: AU_DataText := opm_ComboBox_AskUserList.Text;
0136: AU_ListItem := opm_ComboBox_AskUserList.ItemIndex;
0137: END;
0138: end;
0139:
0140:
0141:
0142:
0143: end.