Yes, this is entirely possible with FSUIPC (or indeed, without). You can find the appropriate event ids in the SDK documentation here. I have done this for a complete implementation of the GNS530 in my Twin Otter cockpit, which is essentially the default FSX GPS with a veneer to make it look like a GNS530. I used Leo Bodnar BBI32 boards, which appear to FSX as collections of simple buttons, with up/down actions. I also used LINDA to make the programming easier. LINDA makes Lua programming more accessible, although for the GPS you do't really need Lua.
There are lots of videos on my YT channel about programming the GPS, including
. You can see the GPS in action in various videos, including
(start from about 3:10)You can find LINDA code for the GPS at my forum (linked from the YT page), although you shouldn't really need it.