Skip to content

Commit

Permalink
Added a label to the dropdown sample.
Browse files Browse the repository at this point in the history
  • Loading branch information
dalefugier committed Apr 9, 2020
1 parent 4185737 commit 5c8ac43
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion rhinopython/SampleEtoColorDropDown.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,22 @@ def __init__(self, colors):
self.m_dropdown.SelectedIndex = 0
self.m_dropdown.SelectedIndexChanged += self.OnSelectedIndexChanged

self.m_label = forms.Label()
self.m_label.Text = self.m_dropdown.Items[0].Text

layout = forms.DynamicLayout()
layout.Padding = drawing.Padding(10)
layout.Spacing = drawing.Size(5, 5)
layout.AddRow("Name:", self.m_label, None)
layout.AddRow("Color:", self.m_dropdown, None)
layout.Add(None, None, True)

self.Content = layout

def OnSelectedIndexChanged(self, sender, e):
msg = "DropDown.SelectedIndexChanged, Value: {0}".format(self.m_dropdown.SelectedIndex)
idx = self.m_dropdown.SelectedIndex
self.m_label.Text = self.m_dropdown.Items[idx].Text
msg = "DropDown.SelectedIndexChanged, Value: {0}".format(idx)
print(msg)

################################################################################
Expand Down

0 comments on commit 5c8ac43

Please sign in to comment.