home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 5_2007-2008.ISO / data / Zips / Jz_PrePar_2043631202007.psc / frmPrePar.frm < prev    next >
Text File  |  2007-01-20  |  11KB  |  353 lines

  1. VERSION 5.00
  2. Begin VB.Form frmPrePar 
  3.    BackColor       =   &H00808080&
  4.    Caption         =   "Part 2: PARAMETERS & PREFERENCES"
  5.    ClientHeight    =   6015
  6.    ClientLeft      =   165
  7.    ClientTop       =   450
  8.    ClientWidth     =   7065
  9.    LinkTopic       =   "Form1"
  10.    ScaleHeight     =   6015
  11.    ScaleWidth      =   7065
  12.    StartUpPosition =   2  'CenterScreen
  13.    Begin VB.PictureBox Picture1 
  14.       Appearance      =   0  'Flat
  15.       BackColor       =   &H80000005&
  16.       ForeColor       =   &H80000008&
  17.       Height          =   2895
  18.       Left            =   150
  19.       Picture         =   "frmPrePar.frx":0000
  20.       ScaleHeight     =   2865
  21.       ScaleWidth      =   2280
  22.       TabIndex        =   1
  23.       Top             =   150
  24.       Width           =   2310
  25.    End
  26.    Begin VB.CommandButton cmdMore 
  27.       Caption         =   "Return ... Part 1"
  28.       Height          =   510
  29.       Left            =   5400
  30.       TabIndex        =   0
  31.       ToolTipText     =   "Open Recent Files form"
  32.       Top             =   195
  33.       Width           =   1425
  34.    End
  35.    Begin VB.Label Label4 
  36.       Alignment       =   2  'Center
  37.       Caption         =   "SUGGESTED TEST:"
  38.       Height          =   195
  39.       Left            =   330
  40.       TabIndex        =   4
  41.       Top             =   3375
  42.       Width           =   6390
  43.    End
  44.    Begin VB.Label Label2 
  45.       Appearance      =   0  'Flat
  46.       BackColor       =   &H80000005&
  47.       BackStyle       =   0  'Transparent
  48.       Caption         =   $"frmPrePar.frx":7A19
  49.       BeginProperty Font 
  50.          Name            =   "Verdana"
  51.          Size            =   9.75
  52.          Charset         =   0
  53.          Weight          =   400
  54.          Underline       =   0   'False
  55.          Italic          =   0   'False
  56.          Strikethrough   =   0   'False
  57.       EndProperty
  58.       ForeColor       =   &H0080FFFF&
  59.       Height          =   1920
  60.       Left            =   3585
  61.       TabIndex        =   3
  62.       Top             =   3735
  63.       Width           =   3165
  64.       WordWrap        =   -1  'True
  65.    End
  66.    Begin VB.Label Label1 
  67.       Appearance      =   0  'Flat
  68.       BackColor       =   &H80000005&
  69.       BackStyle       =   0  'Transparent
  70.       Caption         =   $"frmPrePar.frx":7AD1
  71.       BeginProperty Font 
  72.          Name            =   "Verdana"
  73.          Size            =   9.75
  74.          Charset         =   0
  75.          Weight          =   400
  76.          Underline       =   0   'False
  77.          Italic          =   0   'False
  78.          Strikethrough   =   0   'False
  79.       EndProperty
  80.       ForeColor       =   &H0080FFFF&
  81.       Height          =   1920
  82.       Left            =   300
  83.       TabIndex        =   2
  84.       Top             =   3735
  85.       Width           =   3165
  86.       WordWrap        =   -1  'True
  87.    End
  88.    Begin VB.Shape Shape1 
  89.       BorderColor     =   &H00FFFFC0&
  90.       Height          =   2115
  91.       Left            =   105
  92.       Shape           =   4  'Rounded Rectangle
  93.       Top             =   3630
  94.       Width           =   6810
  95.    End
  96.    Begin VB.Menu mnuFil 
  97.       Caption         =   "&File"
  98.       Begin VB.Menu mnuUsr 
  99.          Caption         =   ""
  100.       End
  101.       Begin VB.Menu mnuExi 
  102.          Caption         =   "E&xit"
  103.       End
  104.    End
  105.    Begin VB.Menu mnuEna 
  106.       Caption         =   "&Enabled Operations"
  107.       HelpContextID   =   6
  108.       Begin VB.Menu mnuEnaDel 
  109.          Caption         =   "&Delete e.g.Anything"
  110.          Enabled         =   0   'False
  111.       End
  112.       Begin VB.Menu mnuEnaTrf 
  113.          Caption         =   "&Transfer e.g.Value"
  114.       End
  115.       Begin VB.Menu mnuEnaEmp 
  116.          Caption         =   "&Empt e.g.Tables"
  117.       End
  118.    End
  119.    Begin VB.Menu mnuChk 
  120.       Caption         =   "&Checked Preferences"
  121.       HelpContextID   =   7
  122.       Begin VB.Menu mnuChkDnt 
  123.          Caption         =   "&Don't e.g. Clear after Write"
  124.       End
  125.       Begin VB.Menu mnuChkWhi 
  126.          Caption         =   "&Change Color Schemme"
  127.       End
  128.       Begin VB.Menu mnuChkHid 
  129.          Caption         =   "Show/Hide (beauty) &Picture"
  130.       End
  131.       Begin VB.Menu mnuChkLod 
  132.          Caption         =   "&Load e.g. At Start"
  133.       End
  134.    End
  135.    Begin VB.Menu mnuVar 
  136.       Caption         =   "&Variables"
  137.       Begin VB.Menu mnuVarTim 
  138.          Caption         =   "Default Initial &Time=9:00"
  139.       End
  140.       Begin VB.Menu mnuVarSig 
  141.          Caption         =   "&Who Signs Doccument=ME"
  142.       End
  143.    End
  144. End
  145. Attribute VB_Name = "frmPrePar"
  146. Attribute VB_GlobalNameSpace = False
  147. Attribute VB_Creatable = False
  148. Attribute VB_PredeclaredId = True
  149. Attribute VB_Exposed = False
  150. Option Explicit
  151. '.----------------------------------------------------------------------
  152. '| Module    : frmPrePar -Template to include and use Parameters on Menu
  153. '| About     : 19/01/2007 12:17 -o- Author: JOZE Walter de Moura
  154. '| Credits   : Thank's a lot to several authors at PSC for about 20% of
  155. '|             all code I've used in this work.
  156. '`======================================================================
  157. '| Purpose   : App Settings at form(s) Menu saved/loaded with a INI File
  158. '| Advantage : No Windows Register, No System Vars, minimum code effort
  159. '`----------------------------------------------------------------------
  160. '  How to:
  161. '    a) use your-form Menu Editor, create about settings types you need:
  162. '           - Checked/Unchecked user preferences;
  163. '           - Enabled/Disabled user permissions;
  164. '           - User/Install pre-fixed Variables;
  165. '           - Customized Caption in Menu;
  166. '           - Others your idea - visible menu itens, etc.
  167. '
  168. '    b) Include modPrePar.Bas module in your Project
  169.  
  170. '    c) See at few highlighted code lines to be your form inserted
  171. '       in some essentials as Form_Load'.
  172. '
  173. '    d) Examine code treatment as sample and aply similar to your App.
  174. '
  175. '  Enjoy, Joze from Rio de Janeiro, Brazil.
  176. '
  177. 'Pre Parameters Initialized Variables
  178. Private egDefSigner As String 'e.g. A person to sign Doccuments (ME)
  179. Private egDefTime As String 'e.g. At what time to Start (9:00)
  180.  
  181. '------------------ Internals for Sample -----------------------
  182. 'Exiting by Menu
  183. Private Sub mnufilexi_Click()
  184.   Unload Me
  185. End Sub
  186.  
  187. 'Returning Previous Form
  188. Private Sub cmdMore_Click()
  189.   frmRecents.Show
  190.   Unload Me
  191. End Sub
  192.  
  193. 'This is to simulate a variable form color schemm
  194. '(poor, only to illustrate)
  195. Private Sub egChangeColors()
  196.    If mnuChkWhi.Checked Then 'no white
  197.       Me.BackColor = &H808080
  198.       Shape1.BorderColor = &HFFFFC0
  199.       Label1.ForeColor = &H80FFFF
  200.       Label2.ForeColor = &H80FFFF
  201.    Else
  202.       Me.BackColor = &HFFFFFF 'white
  203.       Shape1.BorderColor = &HC000&
  204.       Label1.ForeColor = &H404040
  205.       Label2.ForeColor = &H404040
  206.    End If
  207. End Sub
  208.  
  209. '================== USE AS THIS - CUT, PAST, MODIFY RESPECTIVE CODE ==============
  210.  
  211. Private Sub Form_Load()
  212.   Me.Caption = " Part 2: PARAMETERS ON MENU"
  213. '.------------------------------------------------------
  214. 'INIFile ID
  215.    'INI File Name for Parameters ... would be any file.INI, any dir
  216.    JzIniFile = App.Path & "\Sample.Ini"
  217.  
  218.    'Getting Caption for a Menu Item  (direct code)
  219.    JzSection = "Customized Captions"
  220.    JzEntry = "mnuUsr"
  221.    JzValue = "Customized or Translated Caption" ' default value
  222.    JzRemarks = JzValue ' remarks = original Menu item Caption
  223.    JzGetINI
  224.    mnuUsr.Caption = JzValue
  225. 'to test above, do NotePad Sample.Ini and
  226. 'change "mnuUsr" entry to a new phrase
  227. 'so execute me again and see it
  228.  
  229.    'Getting Check Status from INI file
  230.    JzParCheck mnuChkDnt
  231.    JzParCheck mnuChkWhi
  232.    JzParCheck mnuChkLod
  233.    JzParCheck mnuChkHid
  234. 'doing Forms adjusts due preferences
  235.    Picture1.Visible = Not mnuChkHid.Checked
  236.    'restabelish previous color schemm
  237.    egChangeColors
  238.  
  239.    'Getting Enabled Status from INI file
  240.    JzParEnable mnuEnaDel
  241.    JzParEnable mnuEnaTrf
  242.    JzParEnable mnuEnaEmp
  243.  
  244.    'Pre Initialized Variables
  245.    egDefTime = JzParVariable(mnuVarTim, "9:00")
  246.    egDefSigner = JzParVariable(mnuVarSig, "ME")
  247. '`---------------------------------------------------
  248. End Sub
  249.  
  250. '.---------------------------------------------------
  251. ' CHECKED PARAMETERS WILL BE JUST UPDATED
  252. Private Sub mnuChkHid_Click()
  253.   If Not mnuChkHid.Checked Then
  254.      mnuChkHid.Checked = True
  255.   Else
  256.      mnuChkHid.Checked = False
  257.   End If
  258.   JzCheckToINI mnuChkHid
  259.   Picture1.Visible = Not mnuChkHid.Checked
  260. End Sub
  261.  
  262. Private Sub mnuChkDnt_Click()
  263.   If Not mnuChkDnt.Checked Then
  264.      mnuChkDnt.Checked = True
  265.   Else
  266.      mnuChkDnt.Checked = False
  267.   End If
  268.   JzCheckToINI mnuChkDnt
  269.   '
  270.   'Do Anything about Parameters Checked status
  271.   '
  272. End Sub
  273.  
  274. Private Sub mnuChkWhi_Click()
  275.   If Not mnuChkWhi.Checked Then
  276.      mnuChkWhi.Checked = True
  277.   Else
  278.      mnuChkWhi.Checked = False
  279.   End If
  280.   egChangeColors ' e.g. a schemme option
  281.   JzCheckToINI mnuChkWhi
  282.   Me.Refresh
  283. End Sub
  284.  
  285. Private Sub mnuChkLod_Click()
  286.   If Not mnuChkLod.Checked Then
  287.      mnuChkLod.Checked = True
  288.   Else
  289.      mnuChkLod.Checked = False
  290.   End If
  291.   JzCheckToINI mnuChkLod
  292.   '
  293.   'Do Anything about Parameters Checked status
  294.   '
  295. End Sub
  296. '.................. End Code for Checked  ..........................
  297.  
  298. '.------------- IRRELEVANT CODE -------------------------------
  299. 'These Pseudo Procedures is only for code examples aplying
  300. 'Checked Menu Parameters
  301.  
  302. Private Sub egAppAction()
  303. End Sub
  304.  
  305. Private Sub egDoALotOfNothing()
  306. Dim eg_dataf As String
  307.      If eg_dataf = "x" And mnuChkLod.Checked = True Then
  308.         egAppAction
  309.      End If
  310. End Sub
  311. Private Sub DoOperation()
  312.      If mnuEnaEmp.Enabled Then
  313.         'do it
  314.      End If
  315. End Sub
  316. '................. End Irrelevant Code ............................
  317.  
  318. '.---------------------------------------------------
  319. ' VARIABLES PARAMETERS UPDATED VIA INPUTBOX
  320. 'user want modify variables
  321. Private Sub mnuVarTim_Click()
  322.   egDefTime = JzNewVariable(mnuVarTim)
  323. End Sub
  324.  
  325. Private Sub mnuVarSig_Click()
  326.   egDefSigner = JzNewVariable(mnuVarSig, _
  327.       "Who will sign Company Doccuments?")
  328. End Sub
  329. '.................. End code for Variables .................................
  330.  
  331. '.---------------------------------------------------
  332. ' ENABLED PARAMETERS E.G., NO MODIFICATIONS HERE
  333. ' General uses is about light installation permissions
  334. ' once configurated - may be via NotePad Sample.INI
  335. ' or if you want provide a Administrator Form to do it
  336. '
  337. ' Users will not click on it if disabled:
  338.  
  339. Private Sub mnuEnaDel_Click()
  340.    MsgBox "e.g. a Delete Operation" 'Admin
  341. End Sub
  342.  
  343. Private Sub mnuEnaTrf_Click()
  344.    MsgBox "e.g. a Transfer Operation" 'Admin
  345. End Sub
  346.  
  347. Private Sub mnuEnaEmp_Click()
  348.    MsgBox "e.g. a Cleanner Operation" 'Advanced User
  349. End Sub
  350. '................. End Code for Enabled ...........................
  351.  
  352. '-oOo-oOo-oOo-
  353.