1. Michael Kramer
  2. Beta Testing
  3. Wednesday, 15 January 2020 18:12 PM UTC

Does RibbonComboBoxItem have a GetItemByIndex( long index ) that is hiding under a different name?

I found to inspect current item list for a ComboBox I need to ExportToJSON; then parse that full JSON structure (or similar in XML). I would like to use a GetItem function if it exists.

THX /Michael

Mark Lee @Appeon Accepted Answer Pending Moderation
  1. Thursday, 16 January 2020 05:41 AM UTC
  2. Beta Testing
  3. # 1

Hi Michael,

The RibbonComboBoxItem don't have a GetItemByIndex (long index ) function.

You can use theTotalitions, SelectItem and Selectedindex function to work it around.

Please refer to the local PB Help documentation for details.

Here is a sample example:

RibbonComboBoxItem		lr_combobox
ribbonmenu					lr_menu
string 	ls_tag, ls_piclist
integer 	li_rtn
long		ll_count, ll_i

ls_tag = "Page size"
li_rtn = rbb_2.getitembytag( ls_tag, lr_combobox)
if li_rtn = 1 then
	if lr_combobox.allowedit  = true  then 
		lr_combobox.allowedit = false
		lr_combobox.label ="Mark Test:"	
		lr_combobox.text = ""						
		lr_combobox.sorted = false
		lr_combobox.vscrollbar =true
		lr_combobox.hscrollbar =true

		ls_piclist = lr_combobox.getboxpicturelist( )
		ll_count = lr_combobox.totalitems( )

		ll_count = lr_combobox.insertitem( "Large A2",ll_count+1, ll_count+1)						 
		ll_count = lr_combobox.insertitem( "Large A0",ll_count+1, ll_count+1)
		ll_count = lr_combobox.insertitem( "Large A1",ll_count+1, ll_count+1)
		ll_count = lr_combobox.insertitem( "Large A3",ll_count+1, ll_count+1)
		ll_count = lr_combobox.insertitem( "Large A4",ll_count+1, ll_count+1)		

		ls_piclist =ls_piclist+ ",PaperSizeA0Small!,PaperSizeA1Small!,PaperSizeA2Small!,PaperSizeA3Small!,PaperSizeA4Small!"
		li_rtn = lr_combobox.setboxpicturelist( ls_piclist )		

		lr_combobox.boxheight = 900		
		lr_combobox.boxwidth = 600
		lr_combobox.width = 1000
	else
		lr_combobox.allowedit = true
		lr_combobox.label =""
		lr_combobox.text = "Test"		
		lr_combobox.sorted = true
		lr_combobox.vscrollbar =false
		lr_combobox.hscrollbar =false
		ll_count = lr_combobox.totalitems( )
		If ll_count  > 5 then 
			for ll_i = ll_count  to 6 step -1
				lr_combobox.deleteitem( ll_i)
			next 
			ls_piclist = "PaperSizeA0Small!,PaperSizeA1Small!,PaperSizeA2Small!,PaperSizeA3Small!,PaperSizeA4Small!"
			li_rtn = lr_combobox.setboxpicturelist( ls_piclist )
		end if 
		lr_combobox.boxheight = 600
		lr_combobox.boxwidth = 300
		lr_combobox.width = 400		
	end if 
	rbb_2.setcombobox(  lr_combobox.itemhandle , lr_combobox)
end if 

 

Regards,

Comment
  1. Michael Kramer
  2. Thursday, 16 January 2020 06:43 AM UTC
Thx, Mark. Nice tip. I have choice.

(A) As you suggest: 1) GetBoxPictureList for pictures in CSV text. 2) Convert to array. 3) Loop to select each index; 4) Inspect ComboBox.Text = selected item's Text; 5) At end restore original selection.

(B) Alternative: 1) Export to JSON/XML; 2) Parse to find the ComboBox; 3) From ComboBox loop through all its items.
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.