private void FormFormPatEdit_Load(object sender, EventArgs e) { QuestionDefList = QuestionDefs.Refresh(); if (IsNew) { gridMain.Visible = false; butDelete.Visible = false; //only gets filled once on startup, and not saved until OK. for (int i = 0; i < QuestionDefList.Length; i++) { if (QuestionDefList[i].QuestType == QuestionType.FreeformText) { multInput.AddInputItem(QuestionDefList[i].Description, FieldValueType.String, ""); } else if (QuestionDefList[i].QuestType == QuestionType.YesNoUnknown) { multInput.AddInputItem(QuestionDefList[i].Description, FieldValueType.YesNoUnknown, YN.Unknown); } } } else { butOK.Visible = false; butCancel.Text = Lan.g(this, "Close"); multInput.Visible = false; //Gets filled repeatedly. Saved each time user double clicks on a row. Only the answer can be edited. FillGrid(); } /*QuestionDefList=QuestionDefs.Refresh(); * QuestionList=Questions.Refresh(PatNum); * if(QuestionList.Length==0){ * IsNew=true; * gridMain.Visible=false; * butDelete.Visible=false; * //only gets filled once on startup, and not saved until OK. * for(int i=0;i<QuestionDefList.Length;i++){ * if(QuestionDefList[i].QuestType==QuestionType.FreeformText){ * multInput.AddInputItem(QuestionDefList[i].Description,FieldValueType.String,""); * } * else if(QuestionDefList[i].QuestType==QuestionType.YesNoUnknown) { * multInput.AddInputItem(QuestionDefList[i].Description,FieldValueType.YesNoUnknown,YN.Unknown); * } * } * } * else{ * IsNew=false; * butOK.Visible=false; * butCancel.Text=Lan.g(this,"Close"); * multInput.Visible=false; * //Gets filled repeatedly. Saved each time user double clicks on a row. Only the answer can be edited. * FillGrid(); * }*/ }
private void FillGrid() { QuestionList = QuestionDefs.Refresh(); gridMain.BeginUpdate(); gridMain.Columns.Clear(); ODGridColumn col = new ODGridColumn(Lan.g("TableQuestionDefs", "Type"), 110); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableQuestionDefs", "Question"), 570); gridMain.Columns.Add(col); gridMain.Rows.Clear(); ODGridRow row; for (int i = 0; i < QuestionList.Length; i++) { row = new ODGridRow(); row.Cells.Add(Lan.g("enumQuestionType", QuestionList[i].QuestType.ToString())); row.Cells.Add(QuestionList[i].Description); gridMain.Rows.Add(row); } gridMain.EndUpdate(); }