@@ -534,16 +534,18 @@ angular
534534 //-- * value: Default Value for the option
535535 //-- * selected: If this option is the default
536536 //-- * label: Text assigned to the option
537+ //-- * size: Size of the combobox
537538 //--
538539 //-- Returns:
539540 //-- -A string with the HTML code
540541 //-------------------------------------------------------------------------
541- constructor ( options , label , value , formId ) {
542+ constructor ( options , label , value , formId , size = null ) {
542543 //-- Properties
543544 this . label = label ;
544545 this . options = options ;
545546 this . value = value ;
546547 this . formId = formId ;
548+ this . size = size === null ? 'auto' : size ;
547549
548550 //-- Html template for building the combobox field
549551 //-- The parameters are:
@@ -559,7 +561,7 @@ angular
559561 //-- %ID% : Form identification number
560562 //-- %OPTIONS%: Array of available options
561563 this . htmlTemplate = `
562- <div class="form-group">
564+ <div class="form-group" style="width:%SIZE%" >
563565 <label style="font-weight:normal">%LABEL%</label>
564566 <select class="form-control" id="form%ID%">
565567 %OPTIONS%
@@ -625,6 +627,7 @@ angular
625627 let html = this . htmlTemplate . replace ( '%LABEL%' , this . label ) ;
626628 html = html . replace ( '%ID%' , this . formId ) ;
627629 html = html . replace ( '%OPTIONS%' , opts ) ;
630+ html = html . replace ( '%SIZE%' , this . size ) ;
628631
629632 return html ;
630633 }
@@ -638,6 +641,17 @@ angular
638641
639642 return value ;
640643 }
644+
645+ //------------------------------------------------
646+ //-- Attach a callback function to the change event
647+ //-- INPUT:
648+ //-- * callback: Function to execute on change
649+ //------------------------------------------------
650+ onChange ( callback ) {
651+ $ ( `#form${ this . formId } ` ) . on ( 'change' , function ( ) {
652+ callback ( $ ( this ) . val ( ) ) ;
653+ } ) ;
654+ }
641655 }
642656
643657 //---------------------------------------------------------
@@ -1831,6 +1845,29 @@ angular
18311845
18321846 this . addField ( field6 , toolsLabel ) ;
18331847
1848+ //-------- Field 7: Combobox for selecting the display mode
1849+ //-- Options
1850+ let options = [
1851+ {
1852+ value : 1 ,
1853+ label : gettextCatalog . getString ( 'Grid' ) ,
1854+ } ,
1855+ {
1856+ value : 2 ,
1857+ label : gettextCatalog . getString ( 'Manual' ) ,
1858+ } ,
1859+ ] ;
1860+
1861+ let field7 = new ComboboxField (
1862+ options ,
1863+ gettextCatalog . getString ( 'Display mode:' ) , //-- Top message
1864+ 1 , //-- Default value
1865+ 7 , //-- Field id
1866+ 'fit-content' //-- Width
1867+ ) ;
1868+
1869+ this . addField ( field7 , modulePortsLabel ) ;
1870+
18341871 //-- Control the notifications generated by
18351872 //-- the errors when processing the form
18361873 this . resultAlert = null ;
0 commit comments