@@ -14,6 +14,8 @@ public class VKBDeviceTab: TabPage
1414 private readonly TableLayoutPanel TLayout ;
1515 private readonly FlowLayoutPanel FLayout ;
1616 private readonly Label TBox ;
17+ private readonly Label NoEncs ;
18+ private int encCount = 0 ;
1719 public VKBDeviceTab ( VKBDevice dev ) {
1820 TLayout = new TableLayoutPanel {
1921 Dock = DockStyle . Fill ,
@@ -29,18 +31,35 @@ public VKBDeviceTab(VKBDevice dev) {
2931 Dock = DockStyle . Top ,
3032 Text = $ "{ dev . DeviceName } , PID { dev . HidDev . ProductID : X4} , S/N { dev . SerialNumber } "
3133 } ;
34+ NoEncs = new Label
35+ {
36+ Dock = DockStyle . Fill ,
37+ Text = "No Encoders detected. Make sure that the device:\n " +
38+ "1. is running nJoy32 firmware 2.17.9 or newer\n " +
39+ "2. has \" Virtual BUS over USB\" enabled in VKBDevCfg (and the setting has been Set to the device)\n " +
40+ "3. has encoders configured on the physical button layer" ,
41+ TextAlign = System . Drawing . ContentAlignment . MiddleLeft ,
42+ Font = new System . Drawing . Font ( System . Drawing . FontFamily . GenericSansSerif , 16 , System . Drawing . FontStyle . Bold )
43+ } ;
44+
3245 Controls . Add ( TLayout ) ;
3346 TLayout . Controls . Add ( TBox ) ;
34- TLayout . Controls . Add ( FLayout ) ;
47+ TLayout . Controls . Add ( NoEncs ) ;
3548
3649 }
3750 public EncoderBox AddEncoderBox ( VKBEncoder enc )
3851 {
39- if ( FLayout . InvokeRequired )
52+ if ( FLayout . InvokeRequired || TLayout . InvokeRequired )
4053 {
4154 AddEncoderBoxCallback d = new AddEncoderBoxCallback ( AddEncoderBox ) ;
4255 return this . Invoke ( d , new object [ ] { enc } ) as EncoderBox ;
4356 }
57+ if ( encCount == 0 )
58+ {
59+ TLayout . Controls . Remove ( NoEncs ) ;
60+ TLayout . Controls . Add ( FLayout ) ;
61+ }
62+ encCount ++ ;
4463 EncoderBox box = new EncoderBox ( enc ) ;
4564 FLayout . Controls . Add ( box ) ;
4665 return box ;
0 commit comments