Reusable Part S_190RQN

LANSA

Reusable Part S_190RQN

* ===================================================================;
*;
* Component : S_190RQN;
* Type : Reusable Component;
* Ancestor : PRIM_PANL (Primitive Panel);
*;
* Description : Reusable Question Drop Down ;
*;
* Disclaimer : The following material is supplied as sample material;
* only. No warranty concerning this material or its use;
* in any way whatsoever is expressed or implied.;
*;
* ===================================================================;
;
FUNCTION OPTIONS(*DIRECT);
BEGIN_COM DISPLAYPOSITION(1) HEIGHT(25) LAYOUTMANAGER(#ATLM_1) LEFT(0) TABPOSITION(1) TOP(0) WIDTH(279);
DEFINE_COM CLASS(#PRIM_ATLM) NAME(#ATLM_1);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_4) ATTACHMENT(Center) MANAGE(#CMBX_QUES) PARENT(#ATLM_1);
DEFINE_COM CLASS(#PRIM_CMBX) NAME(#CMBX_QUES) COMBOBOXSTYLE(DropDownList) DISPLAYPOSITION(1) LEFT(0) PARENT(#COM_OWNER) TABPOSITION(1) TOP(0) VALUE('aAbBcCdDeEfFgGhHiIjJ') WIDTH(279);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_1) ATTACHMENT(Center) MANAGE(#CMBX_QUES) PARENT(#ATLM_1);
DEFINE_COM CLASS(#PRIM_CBCL) NAME(#CBCL_1) PARENT(#CMBX_QUES) SOURCE(#S_190PQN) VISIBLE(False) WIDTH(20);
DEFINE_COM CLASS(#PRIM_CBCL) NAME(#CBCL_2) DISPLAYPOSITION(1) PARENT(#CMBX_QUES) SOURCE(#S_190PQA) WIDTH(20);
;
define_evt QuestionSelected help('This event is signaled when a different question has been selected');
;
define_pty name(CurrQuestion) get(*auto #S_190PQN ) ;
;
GROUP_BY NAME(#S_GRPPQU) FIELDS(#S_190PID #S_190PQN #S_190PQA #S_190PQS);
;
;
EVTROUTINE HANDLING(#CMBX_QUES.ItemGotFocus) ;
Signal QuestionSelected ;
ENDROUTINE;
;
* Get all questions for a poll and optionally set the focus to a particular question, otherwise the first question ;
* (optionally leave out a particular question);
mthroutine uSetPollQues;
Define_Map *Input #S_190PID #mS_190PID Desc('Set the poll ') Help('Set the list to a poll ');
Define_Map *Input #S_190PQN #mS_190PQN Desc('Optionally set the question') Mandatory(0) ;
Define_Map *Input #S_190PQN #mS_190NOT Desc('Optionally leave out this question') Mandatory(0) ;
;
change #S_190PID #mS_190PID.value;
change #S_190PQN #mS_190PQN.value;
change #S_190PQNX #mS_190NOT.value;
;
DEFINE #S_190PQNX reffld(#S_190PQN) DESC('Question to be left out of the list');
;
execute LOADQUES with_parms(#S_190PID #S_190PQN);
;
endroutine;
*;
* Set the focus to a particular question in the same poll;
mthroutine uSetQuestion;
Define_Map *Input #S_190PQN #mS_190PQN Desc('xxxx') Help('A different question for the same poll');
;
change #S_190PQN #mS_190PQN.value;
;
selectlist #CMBX_QUES;
continue if('#S_190PQN *ne #mS_190PQN.Value') ;
;
set #CMBX_QUES.CurrentItem Focus(True) ensurevisible(TRUE);
* the field #S_190PQN is automatically set to the current list entry (for combo boxes);
;
signal QuestionSelected;
return;
endselect;
;
* The question specified was not in the combo box (Could be the wrong type);
get_entry number(1) from_list(#CMBX_QUES);
set #CMBX_QUES.CurrentItem Focus(True) ensurevisible(TRUE);
signal QuestionSelected;
return;
;
endroutine;
*;
* load all questions for the poll into the list box (in sequence order);
Subroutine LOADQUES parms(#S_190PID #S_190PQNW);
DEFINE #S_190PQNW reffld(#S_190PQN);
clr_list #CMBX_QUES;
;
CHANGE #CMBX_QUES *NULL;
ADD_ENTRY #CMBX_QUES;
select (#S_GRPPQU) from_file(SETPQUL3) with_key(#S_190PID);
IF '(#S_190PQNX *EQ 0) *OR (#S_190PQN *NE #S_190PQNX)' ;
CASE #S_190PQS;
WHEN VALUE_IS('= YESNO' '= YESNOUNK' '= SELECT');
add_entry #CMBX_QUES;
OTHERWISE;
* Only single selection response questions can be compared in this version of the program ;
endcase;
endif;
endselect;
;
IF '#S_190PQNW *EQ 0';
get_entry number(1) from_list(#CMBX_QUES);
set #CMBX_QUES.CurrentItem Focus(True) ensurevisible(TRUE);
signal QuestionSelected;
else;
invoke #com_owner.uSetQuestion mS_190PQN(#S_190PQNW);
endif;
endroutine;
END_COM;