Source code of file oscpmwin/askcat.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 askcat;
0023:   
0024:   interface
0025:   
0026:   uses
0027:     Classes, Controls, Forms,
0028:     StdCtrls, Buttons, ComCtrls, oscpmdata;
0029:   
0030:   type
0031:     Topm_Form_AskCat = class(TForm)
0032:       opm_TabControl_AskCat: TTabControl;
0033:       opm_Edit_AskCatName: TEdit;
0034:       opm_Label_AskCatTitle: TLabel;
0035:       opm_BitBtn_AskCatOk: TBitBtn;
0036:       opm_BitBtn_AskCatCancel: TBitBtn;
0037:       procedure FormShow(Sender: TObject);
0038:       procedure opm_BitBtn_AskCatOkClick(Sender: TObject);
0039:       procedure FormCreate(Sender: TObject);
0040:       procedure opm_TabControl_AskCatChange(Sender: TObject);
0041:       procedure opm_TabControl_AskCatChanging(Sender: TObject;
0042:         var AllowChange: Boolean);
0043:     private
0044:       { Private declarations }
0045:     public
0046:       AC_Title : STRING;
0047:       AC_Directions : STRING;
0048:       AC_MaxLen : LONGINT;
0049:       AC_ClearCats : BOOLEAN;
0050:       AC_CategoryData : opmT_SingleCatList;
0051:     end;
0052:   
0053:   var
0054:     opm_Form_AskCat: Topm_Form_AskCat;
0055:   
0056:   implementation
0057:   
0058:   {$R *.dfm}
0059:   
0060:   uses gnugettext, dataman;
0061:   
0062:   
0063:   
0064:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0065:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0066:   procedure Topm_Form_AskCat.FormShow (Sender: TObject);
0067:   VAR
0068:     CurLang : LONGINT;
0069:     DisplayTabIndex : LONGINT;
0070:   begin
0071:     opm_Form_AskCat.Caption := AC_Title;
0072:     opm_Label_AskCatTitle.Caption := AC_Directions;
0073:     opm_Edit_AskCatName.MaxLength := AC_MaxLen;
0074:     opm_TabControl_AskCat.Tabs.Clear;
0075:     opm_TabControl_AskCat.Tabs := opmG_LanguageBoxList;
0076:     DisplayTabIndex := opmC_Def_DisplayLang;
0077:     FOR CurLang := 0 TO (opm_TotalLanguages - 1) DO
0078:       IF (opm_CurrentLang = opmG_LanguageList[CurLang].ID) THEN
0079:         BEGIN
0080:           DisplayTabIndex := CurLang;
0081:           BREAK
0082:         END;
0083:     opm_TabControl_AskCat.TabIndex := DisplayTabIndex;
0084:     IF (AC_ClearCats = TRUE) THEN
0085:       FOR CurLang := 0 TO (opm_TotalLanguages - 1) DO
0086:         BEGIN
0087:           AC_CategoryData[CurLang].ID := -1;
0088:           AC_CategoryData[CurLang].Parent := 0;
0089:           AC_CategoryData[CurLang].Name := '';
0090:           AC_CategoryData[CurLang].LanguageID := opmG_LanguageList[CurLang].ID;
0091:         END;
0092:     opm_Edit_AskCatName.Text := AC_CategoryData[DisplayTabIndex].Name;
0093:     opm_Form_AskCat.FocusControl (opm_Edit_AskCatName);
0094:   end;
0095:   
0096:   
0097:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0098:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0099:   procedure Topm_Form_AskCat.opm_BitBtn_AskCatOkClick(Sender: TObject);
0100:   VAR
0101:     CurLang : LONGINT;
0102:   begin
0103:     AC_CategoryData[opm_TabControl_AskCat.TabIndex].Name := FNopm_CleanString (opm_Edit_AskCatName.Text);
0104:     FOR CurLang := 0 TO (opm_TotalLanguages - 1) DO
0105:       IF (AC_CategoryData[CurLang].ID > 0) THEN
0106:         IF (AC_CategoryData[CurLang].Name = '') THEN AC_CategoryData[CurLang].Name := opmC_Unamed_Cat;
0107:   end;
0108:   
0109:   
0110:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0111:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0112:   procedure Topm_Form_AskCat.FormCreate(Sender: TObject);
0113:   begin
0114:     AC_Title := '';
0115:     AC_Directions := '';
0116:     AC_MaxLen := opmC_CatName_MaxLen;
0117:     AC_ClearCats := FALSE;
0118:     IF (opmG_UIHotTracking > 0) THEN
0119:       BEGIN
0120:         opm_TabControl_AskCat.HotTrack := TRUE;
0121:         opm_TabControl_AskCat.HotTrack := TRUE;
0122:       END
0123:     ELSE
0124:       BEGIN
0125:         opm_TabControl_AskCat.HotTrack := FALSE;
0126:         opm_TabControl_AskCat.HotTrack := FALSE;
0127:       END;
0128:     TranslateComponent (self);
0129:   end;
0130:   
0131:   
0132:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0133:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0134:   procedure Topm_Form_AskCat.opm_TabControl_AskCatChange(Sender: TObject);
0135:   begin
0136:     opm_Edit_AskCatName.Text := AC_CategoryData[opm_TabControl_AskCat.TabIndex].Name
0137:   end;
0138:   
0139:   
0140:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0141:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0142:   procedure Topm_Form_AskCat.opm_TabControl_AskCatChanging (Sender: TObject; var AllowChange: Boolean);
0143:   begin
0144:     AC_CategoryData[opm_TabControl_AskCat.TabIndex].Name := FNopm_CleanString (opm_Edit_AskCatName.Text);
0145:   end;
0146:   
0147:   end.
 
 
NA fum/lmd: 2007.07.15
Copyright ©1994-2024 by Mario A. Valdez-Ramírez.
no siga este enlace / do not follow this link