Up | Example 01 - ComboBox | Example 02 - ListBox | Example 03 - Labels class derived from Winforms.Panel | Example 04 - Button with Resize Event | Example 05 - CheckBox | Example 06 - GroupBox | Example 07 - Modeless Status Dialog | Example 08 -Timer | Example 09 -TextBox | Example 10 - Custom Button Class | Example 11 - Product Selection ComboBox | Example 12 - Simple ListView

 

  

 
Example 11 - Product Selection ComboBox
The example defines a Product Selection ComboBox Class - connected to an ExternalDictionary tool.

  import CLR
  import CLR.System.Windows.Forms as WinForms
  from CLR.System.Drawing import Size, Point, Pen, Color, SystemColors
  from CLR.System.Drawing import ContentAlignment, Font, FontStyle, Image
 
   class SelectProductCombo(WinForms.ComboBox):

    def __init__(self):
       pass

    def Init(self,nameOfDictionary,nameOfSelection):

      self.nameOfDictionary = nameOfDictionary
      self.nameOfSelection = nameOfSelection
      self.SelectedValueChanged += self.SelectedValueChangedHandler
      self.SetProductComboBox()

    def SetProductComboBox(self):
      plist = GetResultValue(nameOfDictionary)
      print plist
      list = []
      for element in plist:
        print element
        list.append(element)
      print list
      list.sort()
      for product in list:
        self.Items.Add(str(product))
      self.Text = str(GetValue(self.nameOfSelection))

    # eventhandler
    def SelectedValueChangedHandler(self, sender, args):
      SetValue(self.nameOfSelection,int(self.Text))

Example 1: Instantiate Product Selection ComboBox

   # Create the select product combobox
      self.SelectProduct = SelectProductCombo()
      self.SelectProduct.Parent = self
      self.SelectProduct.Size = Size(150,30)
      self.SelectProduct.Location = Point((3*self.Width/2-self.SelectProduct.Width)/2,120)
      self.SelectProduct.Font= Font(self.FontName, 16, FontStyle.Bold)
      self.SelectProduct.Init(nameOfDictionary,nameOfSelection)


 

 
 

Scorpion Vision Version XII : Build 646 - Date: 20170225
Scorpion Vision Software® is a registered trademark of Tordivel AS.
Copyright © 2000 - 2017 Tordivel AS.