Changing the colour of a graphics object dynamically by RGB at runtime

This sounds like a simple objective but hard to achieve in practise unless I'm missing something.

I can easily place a graphics object on a page, and set its colour to any RGB value, at design time. I can even pre-configure several colour options and use an expression to pick one of them at runtime,

But how can I set an arbitrary colour at runtime?

The use case is simple: I need to show the colour of some lighting. The colour can change at runtime to any RGB combination (with R,G,B each being 8-bit UINTs). How can I show that colour on a graphics page? (Consider a slider each for R, G & B, and a box that shows the colour as the sliders are moved.)

The best I have come up with so far is to create my own ActiveX object to do it, although I'd really prefer not to do it outside Citect and especially not with something like ActiveX (it's 2022!). 

I'm having a discussion with support about it and figured it might be useful to see if anyone else has any clever ideas I haven't thought of!

In case it's relevant I need to show anything up to about 50 different colours on the same page simultaneously, and I need the resulting object to behave like other graphics objects (I need to be able to hide it, or to click on it to trigger a Cicode function, etc).

Parents
  • Wow - that seems harder than it should be.

    DspCol( ) seems to be a deprecated function.  Can't find any old code as far as what it did.

    I'm getting confused about the Graphics Builder Automation -

    AttributeFillColour(Fillcolour)

    Not sure if you can invoke GBA from Citect VBA, or if you would have to call it from somehing else that could call VBA.

    I know that isn't much of an answer, but just some ideas that may or may not work.

  • I'm sure I looked at DspCol() and discounted it but can't now recall why - that its deprecated is a disadvantage but that's not a show stopped, I would be very surprised if the DspX functions don't outlast ActiveX support.

    GBA is compile-time - a way to create/edit graphics pages rather than to make dynamic changes at runtime (unless I'm missing something?)

  • Update to add that I've just spent some time playing with DspCol and cannot get it to do anything at all.

    So for example create a bit of text, note its animation number X, and try DspAn(X, 255) to set its colour. Nothing changes. DspAnMove(X,200,200) (for example) works fine so the AN is correct.

    I fear that "deprecated" means "doesn't work"! I've searched the Include/Example projects for any example of its use (perhaps in legacy code) but no success.

Reply
  • Update to add that I've just spent some time playing with DspCol and cannot get it to do anything at all.

    So for example create a bit of text, note its animation number X, and try DspAn(X, 255) to set its colour. Nothing changes. DspAnMove(X,200,200) (for example) works fine so the AN is correct.

    I fear that "deprecated" means "doesn't work"! I've searched the Include/Example projects for any example of its use (perhaps in legacy code) but no success.

Children