Get what radiobutton element has ben chosen - RadaeePDF.com
Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
13 Jul 2017
Microsoft has ended support for Windows Phone 8.1
Read More...
Questions about Android development and PDF
  • Page:
  • 1

TOPIC: Get what radiobutton element has ben chosen

Get what radiobutton element has ben chosen 1 year 9 months ago #11818

  • dcalonego
  • dcalonego's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 3
  • Thank you received: 0
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?

Please Log in or Create an account to join the conversation.

Get what radiobutton element has ben chosen 1 year 9 months ago #11819

  • nermeen
  • nermeen's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 865
  • Karma: 23
  • Thank you received: 70
What exactly you mean by value?

You can get the index of the selected radio button annot using the following 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);
}

Please Log in or Create an account to join the conversation.

Get what radiobutton element has ben chosen 1 year 9 months ago #11821

  • dcalonego
  • dcalonego's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 3
  • Thank you received: 0
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.
Attachments:

Please Log in or Create an account to join the conversation.

Get what radiobutton element has ben chosen 1 year 9 months ago #11828

  • nermeen
  • nermeen's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 865
  • Karma: 23
  • Thank you received: 70
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)
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.)

Please Log in or Create an account to join the conversation.

Last edit: by nermeen.
  • Page:
  • 1
Powered by Kunena Forum