KIT PAT 304 - Exercise 10 - Training Pull Down Menu

Unformatted text preview:

Training Pull Down MenuExercise Description:Files:File Supplied/Created DescriptionExercise Procedure:1. Edit the PCL function in the file exercise_10.template. Replace the blanks with the appropriat...2. Compile the function.3. Start MSC/PATRAN by typing p3 in your xterm window.4. Test the function by typingSample Solution:Objectives:PATRAN 304 Exercise Workbook 10-1EXERCISE 10Objectives:■ Write a function to create a pull down menu from thetop menu bar in the main window.■ The pull down menu will be used to call the rest of theexercises you will create in this training class.Training Pull Down MenuPATRAN5-Dec-95 03:38:15/95 03:36:58 PMs)...◆◆Properties◆◆Load Cases◆◆Fields◆◆Analysis◆◆Results◆◆Insight◆◆XY Ploteferences Tools Training HelpExercise 1Exercise 2Exercise 3Exercise 4Exercise 5Exercise 6Exercise 7Exercise 8Exercise 9Exercise 10Exercise 11Exercise 12Exercise 13Exercise 14Exercise 15Exercise 16Exercise 1710-2 PATRAN 304 Exercise WorkbookEXERCISE 10 Training Pull Down MenuPATRAN 304 Exercise Workbook 10-3Exercise Description:This exercise, the training class, creates a pull downmenu and displays it from the top menu bar. Thereshould be a selection option for each exercise. Theselection of exercise 1 through 10 should only print averification message to the command window such as“you have selected exercise 10”. The others shouldexecute the functions created in those exercises.Files:All the files that used in this exercise are listed below.Each list includes the file, where it originated, and asummary of information of how it relates to the exercise.File Supplied/Created Descriptionexercise_10.template Supplied This is a template file that should beedited with the correct PCL syntax.training.pcl Created The file is created from the templatefile when all the blanks are filledand the file is renamed.Exercise Procedure:1. Edit the PCL function in the fileexercise_10.template. Replace the blanks with theappropriate PCL expressions. Rename the file totraining.pcl when you are done.2. Compile the function.Start MSC⁄PATRAN complier by typing p3pclcomp inyour xterm window.Enter the command:!!input training.pclinto the command line.All the error messages and diagnostics will be written tothe xterm window.3. Start MSC/PATRAN by typing p3 in your xtermwindow.10-4 PATRAN 304 Exercise Workbook4. Test the function by typingtraining.init ()at the command line.Select item 1-10 from the menu.Your menu should appear as shown.PATRANPATRANences Tools Helpec-95 03:38:153:36:58 PMroperties◆◆Load Cases◆◆Fields◆◆Analysis◆◆Results◆◆Insight◆◆XY PlotTrainingExercise 1Exercise 2Exercise 3Exercise 4Exercise 5Exercise 6Exercise 7Exercise 8Exercise 9Exercise 10Exercise 11Exercise 12Exercise 13Exercise 14Exercise 15Exercise 16Exercise 17EXERCISE 10 Training Pull Down MenuPATRAN 304 Exercise Workbook 10-5Sample Solution:CLASS training FUNCTION init() WIDGET menubar, menu, item12, @item13, item14, item 15, item16, item 17 /* get the widget id of the top menu bar * from the uil_primary class in the main program * This will be used to hang the trainig menu from * the top menu bar, i.e. the same level as the file * selection menu. */menubar= uil_primary.get_menubar_id()menu= ui_menu_create (menubar, “training_menu”, “Training”)ui_item_create (menu, “EX_1”, “Exercise 1”, FALSE )ui_item_create (menu, “EX_2”, “Exercise 2”, FALSE )ui_item_create (menu, “EX_3”, “Exercise 3”, FALSE )ui_item_create (menu, “EX_4”, “Exercise 4”, FALSE )ui_item_create (menu, “EX_5”, “Exercise 5”, FALSE )ui_item_create (menu, “EX_6”, “Exercise 6”, FALSE )ui_item_create (menu, “EX_7”, “Exercise 7”, FALSE )ui_item_create (menu, “EX_8”, “Exercise 8”, FALSE )ui_item_create (menu, “EX_9”, “Exercise 9”, FALSE )ui_item_create (menu, “EX_10”, “Exercise 10”, FALSE )ui_item_create (menu, “EX_11”, “Exercise 11”, FALSE )item12= ui_item_create (menu, “EX_12”, “Exercise 12”, FALSE )item13= ui_item_create (menu, “EX_13”, “Exercise 13”, FALSE )item14= ui_item_create (menu, “EX_14”, “Exercise 14”, FALSE )item15= ui_item_create (menu, “EX_15”, “Exercise 15”, FALSE )item16= ui_item_create (menu, “EX_16”, “Exercise 16”, FALSE )item17= ui_item_create (menu, “EX_17”, “Exercise 17”, FALSE ) /* disable the last six picks to be used in the future * extension to the menu. */ui_wid_set (**********1*********) Give the parameters for these functionsui_wid_set (**********2*********)ui_wid_set (**********3*********)ui_wid_set (**********4*********)ui_wid_set (**********5*********)ui_wid_set (**********6*********) END FUNCTION /* init */FUNCTION training_menu ( item_name ) STRING item_name[] ! the value for the item is ‘item_name‘10-6 PATRAN 304 Exercise WorkbookSWITCH (item_name)CASE (“EX_1”)WRITE (“ you have selected Exercise 1 “)CASE (“EX_2”)WRITE (“ you have selected Exercise 2 “)CASE (“EX_3”)WRITE (“ you have selected Exercise 3 “)CASE (“EX_4”)WRITE (“ you have selected Exercise 4 “)CASE (“EX_5”)WRITE (“ you have selected Exercise 5 “)CASE (“EX_6”)WRITE (“ you have selected Exercise 6 “)CASE (“EX_7”)WRITE (“ you have selected Exercise 7 “)CASE (“EX_8”)WRITE (“ you have selected Exercise 8 “)CASE (“EX_9”)WRITE (“ you have selected Exercise 9 “)CASE (“EX_10”)WRITE (“ you have selected Exercise 10”)CASE (“EX_11”)WRITE (“ you have selected Exercise 11”)UI_EXEC_FUNCTION (************7*************)CASE (“EX_12”)WRITE (“ you have selected Exercise 12 “)UI_EXEC_FUNCTION (************8*************)CASE (“EX_13”)WRITE (“ you have selected Exercise 13 “)UI_EXEC_FUNCTION (************9*************)CASE (“EX_14”)WRITE (“ you have selected Exercise 14 “)UI_EXEC_FUNCTION (***********10*************)CASE (“EX_15”)WRITE (“ you have selected Exercise 15 “)UI_EXEC_FUNCTION (***********11*************)CASE (“EX_16”)WRITE (“ you have selected Exercise 16 “)UI_EXEC_FUNCTION (***********12*************)CASE (“EX_17”)WRITE (“ you have selected Exercise 17 “)UI_EXEC_FUNCTION (***********13*************)END SWITCH END FUNCTION /* training_menu */END CLASS /* training */EXERCISE 10 Training Pull Down MenuPATRAN 304 Exercise Workbook 10-7*1* item12, “ENABLE”, FALSE*2* item13, “ENABLE”, FALSE*3* item14, “ENABLE”, FALSE*7*


View Full Document

KIT PAT 304 - Exercise 10 - Training Pull Down Menu

Download Exercise 10 - Training Pull Down Menu
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Exercise 10 - Training Pull Down Menu and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Exercise 10 - Training Pull Down Menu 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?