I have a task where a user on a Windows Client wants to use his touch screen to select from a limited set of Items. In NAV 2009 R2 this was a form with buttons and I have been waiting to update this to NAV 2013 R2 until I had finished most of the other tasks for that client. That time is now.
I attended the session on Directions EMEA where Vjeko presented client extensions. I also saw a post by Rashed on his mibuso blog about buttons.
So I started the task. I have done several add-ins for NAV so I know enough about Visual Studio to feel comfortable using it. Of course, when ever one starts something like this there is always something new to learn and use. To search for help on C# on the internet is really helpful and we have a lot of good examples out there.
Like Rashed, I created a panel that hosted all the buttons and text boxes and that panel is the object added to the NAV page.
I wanted to be able to customize all the buttons and text boxes from NAV so I created default values and null able values for all my properties. Then I created a property for every value that I wanted NAV to have access to in the class.
After I created the panel control I wanted a trigger to fire in NAV to tell me that the add-in was ready. I followed the example Vjeko gave in last Directions but that simply did not work. I contacted him and that resulted in a new blog on Vjeko’s site. Instead of triggering an event when creating the control the trigger is now fired after the control is bound to the NAV page.
When I get the trigger fired in NAV I create the buttons with all the properties I need.
The test page I created will allow me to select any number of buttons and/or text boxes. I can customize background and foreground color, font family and font size. Some of these settings can be done for each button or text box individually, that is the ones included in the arrays used when calling the CreateButtons function with arrays create from the Item table using these settings.
In the add-in I have created two event handlers to handle the push of a button or a text change.
This is handled in the NAV page with this code.
So when I press a button or change a text I will get a message from NAV.
I also made sure that if I select zero as a size for either the buttons or the text boxes they will not show.
I have adapted a new method when sharing objects and information. I will publish on my blog how things are done if you want to create your own version and will also supply a version you can download and start using at Objects4NAV.com.