# GRC Block with Selectable Item Type

**URL:** <https://www.ruby-forum.com/t/grc-block-with-selectable-item-type/242471>\
**Category:** GNU Radio\
**Created:** [June 26, 2015, 1:55am UTC](https://www.ruby-forum.com/t/grc-block-with-selectable-item-type/242471 "2015-06-26T01:55:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [June 26, 2015, 1:55am UTC](https://www.ruby-forum.com/t/grc-block-with-selectable-item-type/242471/1 "2015-06-26T01:55:37Z")

</div>

Hi all,

I made a custom block that I’d like to allow the user to select item  
type  
of. I started following in the footsteps of the copy block, but instead  
of  
having the drop down menu update the blocks ports to reflect a type  
change,  
it lists the selected type as text on the face of the block, and does  
not  
update the ports at all. The block comes in by default with complex port  
types, and selecting any other type does not change this. If I connect a  
byte wire to the block it will cause an error, even if I select byte.

So then I looked at the agc block to see if I could find a difference.  
Here  
it looks like the type selection was implemented by making different  
source  
code for each type.

I’d like to implement it the way the copy block does, but I don’t know  
what’s wrong. Is there something else I should know about doing this  
that  
I’m overlooking?

Thanks,  
Rich

---

<div class="post-metadata">

**Author:** ![reback](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/b5ac83/32.png) [@reback](https://www.ruby-forum.com/u/reback)\
**Post date:** [June 26, 2015, 2:17am UTC](https://www.ruby-forum.com/t/grc-block-with-selectable-item-type/242471/2 "2015-06-26T02:17:49Z")

</div>

Nevermind. I overlooked updating the soure/sink ports with $type in the  
xml.

Rich

On Thu, Jun 25, 2015 at 4:54 PM, Richard B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
