Microsoft Windows Phone 8.1 support ends (13 Jul 2017)

Microsoft has ended support for Windows Phone 8.1

Questions about Android development and PDF

Get what radiobutton element has ben chosen

More
9 years 7 months ago #11818 by dcalonego
How can I get which value of a radio button group has been chosen?
For what I can find in the sdk, you can see if it is checked something with annot.GetCheckStatus() and set the tapped value with annot.SetRadio(), but you can't get which value has been chosen. Is it possible?
More
9 years 7 months ago #11819 by nermeen
What exactly you mean by value?

You can get the index of the selected radio button annot using the following code:
Code:
Page page = m_view.PDFGetDoc().GetPage0(); page.ObjsStart(); for(int i = 0 ; i < page.GetAnnotCount() ; i++) { Annotation annotation = page.GetAnnot(i); if(annotation != null && annotation.GetType() == 20 && annotation.GetFieldType() == 1 && annotation.GetCheckStatus() == 3) Log.d("tag", "selected radio annot index = " + i); }
More
9 years 7 months ago #11821 by dcalonego
Attached a pdf document to explain what I mean better.

Here you can see a radiobutton group called "radiobutton1" composed by three choices.
Each one has a different value assigned (Nina, Pinta, Santa Maria).
I need to understand if and how is possible to:
  • Get which of the three has been chosen by the user (on the event OnPDFRadioButtonTapped is pressed the annotation returned is the entire group)
  • Get the value of the item chosen

Hope it's all clear.
More
9 years 7 months ago - 9 years 7 months ago #11828 by nermeen
It depends on how these values are assigned..

Using Annotation.GetFieldFullName, the values returned are "radiobutton1#0", "radiobutton1#1", "radiobutton1#2"

Using Annotation Properties article, you can get more information about the annotation. (you can get the value, using the tag AS)
Code:
Page page = m_view.PDFGetDoc().GetPage0(); page.ObjsStart(); for(int i = 0 ; i < page.GetAnnotCount() ; i++) { Annotation annotation = page.GetAnnot(i); if(annotation != null && annotation.GetType() == 20 && annotation.GetFieldType() == 1 && annotation.GetCheckStatus() == 3) checkAnnotAdvancedProp(annotation); } page.Close():

Using the above code, it will be called only for the selected choice, not the entire group (i do not know how OnPDFRadioButtonTapped is implemented, you share it if you cannot figure out what is wrong with it.)
Last edit: 9 years 7 months ago by nermeen.
Time to create page: 0.415 seconds
Powered by Kunena Forum