Jump to content

Adding blank entries to popup controls


Recommended Posts

641964009_CalculuxDialog.png.380acedfd9066b3a89befa2fdaa3de1e.png

 

With much gratitude to Pat Stanford, JBenghiat, Sam Jones and Jesse Cogswell (btw, how'd I tag them in a post?) I got my script complete, as shown .

It takes an imported spreadsheet, with a key to lighting devices, and the user (via a popup list) gets to assign actual lighting devices to the key, then inserts the correct lighting devices with all relevant data attached.

 

My question is about the resource popup. I'd like it to default to a blank image. In the screenshot, I have imported the CSV and simply selected a key entry, yet the popup shows the clamp object. 

 

1. I don't want key A to refer to the clamp.

2. It doesn't anyway. I'm using the popup events to assign the symbol to the key. No event, no key.

3. Although it doesn't show here, once I have set key 'A' to a device, when I select an empty key the popup doesn't change. It swaps nicely between assigned keys, but the control doesn't change when choosing an unassigned key. I'd like an unassigned key to blank the popup.

 

Is there a way to add a 'blank' entry to a popup?

 

Something like: 

PopupIndex = vs.InsertImagePopupResource( dialog, dlg.kLightPopup, None, 0 )

 

Thank you.

Link to comment
10 minutes ago, JBenghiat said:

As far as I know, there is not, other than creating a temporary empty symbol. 

That sounds EXACTLY what I was looking for.

 

    tmpSym = "no key"

    vs.BeginSym(tmpSym)

    vs.ArcByCenter(0, 0, 1, 0, 360)

    vs.Rect(-1, -1, 1, 1)

    vs.SetPenFore(vs.LNewObj(), vs.RGBToColorIndex(65535, 65535, 65535))

    vs.EndSym()

    vs.InsertImagePopupObjectItem(dialog, dlg.kLightPopup, tmpSym)  

 

Seems to be doing what I want. Except it leaves the symbol in the drawing, visible in the resource manager. How would I create a genuinely temp symbol?

 

As for the second problem, the popup not switching to the blank icon... turns out the popup list is 1-based. Oh well. You live 'n' learn... 😄

 

Thank you, once again.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...