From 936d918402d764d692e85e7d9cfaba4778eb49b9 Mon Sep 17 00:00:00 2001 From: MurKit Date: Fri, 21 Apr 2017 01:35:17 +0300 Subject: [PATCH] Dropdown selects the actual selected port (#15) Also mentioned against issue #14. --- SerialPortWindow.pde | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/SerialPortWindow.pde b/SerialPortWindow.pde index 09b02a8..98f8d8d 100644 --- a/SerialPortWindow.pde +++ b/SerialPortWindow.pde @@ -31,9 +31,9 @@ ControlFrameSimple addSerialPortControlFrame(String theName, int theWidth, int t ScrollableList sl = p.cp5().addScrollableList("dropdown_serialPort") .setPosition(10, 10) - .setSize(150, 100) + .setSize(150, 150) .setBarHeight(20) - .setItemHeight(20) + .setItemHeight(16) .plugTo(this, "dropdown_serialPort"); sl.addItem("No serial connection", -1); @@ -61,9 +61,11 @@ ControlFrameSimple addSerialPortControlFrame(String theName, int theWidth, int t void dropdown_serialPort(int newSerialPort) { println("In dropdown_serialPort, newSerialPort: " + newSerialPort); + + // No serial in list is slot 0 in code because of list index + // So shift port index by one newSerialPort -= 1; - if (newSerialPort == -2) { }