App designer - how to use numpad instead of number keys?
    3 views (last 30 days)
  
       Show older comments
    
    Teshan Rezel
      
 on 13 Apr 2021
  
    
    
    
    
    Commented: Gaadisaa Merdassa
 on 18 Jan 2023
            Hi folks,
I have the following code, but was wondring if it can be adjusted to use the numpad inputs as well as the number keys? 
Thanks
function UIFigureKeyPress(app, event)
    switch event.Key
        case '1'
            Incipient1ButtonPushed(app);
        case '2'
            Circular2ButtonPushed(app);
        case '3'
            Lenticular3ButtonPushed(app);
        case '4'
            Ribbon4ButtonPushed(app);
        case '5'
            Isotropic5ButtonPushed(app);
        case '6'
            Filler6ButtonPushed(app);
        case '7'
            ResinButtonCokePushed(app);
        case 'f5'
            RefreshF5ButtonPushed(app);
        case 'leftarrow'    
            ReverseButtonPushed(app);
        case 'rightarrow'
            SkipCurrentImageRightArrowButtonPushed(app);
    end
end
1 Comment
  Gaadisaa Merdassa
 on 18 Jan 2023
				@Teshan Rezel, were you able to use the numpad now? I am having similar issue. I am a beginner to MATLAB app designer and I am trying to develop a calculator. I did it but I cannot use the numpad to enter the numbers.
Accepted Answer
  Adam Danz
    
      
 on 14 Apr 2021
        
      Edited: Adam Danz
    
      
 on 14 Apr 2021
  
      Place a break point at the top of the UIFigureKeyPress function.  Press a numpad key and look at the value of event.Key to determine the key code for numpad keys.  Then add those values to the cases.  
Multiple case matches are combined in cell strings.  
Demo
After running these two lines, press different keys while the figure is current and look at the command window outputs.  
uif = uifigure(); 
uif.KeyPressFcn = @(h,event)disp(event)
0 Comments
More Answers (0)
See Also
Categories
				Find more on Develop Apps Using App Designer in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!