Trouble with 'if' statement, button event

I don't know what's going on with the parameter problem but I offer the following to reduce your code and the brittleness of your project.

  1. On the view create a custom property object with structure something like this:
dataLeft
    desc :
    notes :
    classification :
    category :
    stocked :
    review :
    shortDesc :
  1. Bind each of the respective coord_Left components to the custom object and make the bindings bi-directional.
  2. Now the first block of seven lines of your code becomes,
dataLeft = self.view.custom.dataLeft
  1. Create a second custom property object, dataRight.
  2. Generate the coord_Right components using:
dataRight = {}
dataRight["Item ID"] = item_id
dataRight["Category"] = str(dataLeft["category"])
dataRight["Class"] = str(dataLeft["classification"])
dataRight["Desc"] = desc[quote="mdemaris, post:3, topic:76892"] # What's going on here?
dataRight["Short"] = dataLeft["shortDesc"]
dataRight["Stocked"] = str(dataLeft["stocked"])
self.view.custom.dataRight = dataRight
  1. Bind all the coord_Right components to the custom parameter object members.

I suspect that most of this routine could be eliminated by disabling the button that calls this event until all the relevant fields have been filled out. Show a red * or icon beside each field until it's got a legitimate value and provide a tooltip on the icon to indicate what the problem is.

1 Like