Draw on top of or change color of form control

So I tried this:

``

switch(classIdGet(myForm.control(object.id())))

`

{

case classnum(FormFunctionButtonControl):

{

FormFunctionButtonControl = object;

FormFunctionButtonControl.colorScheme(FormColorScheme::RGB);

FormFunctionButtonControl.backgroundColor(WinAPI::RGB2int(255, 255, 0));

info(“here!”);

break;

`

}
But the button doesn’t change. I have tried myForm.redraw() and myForm.reload() and it does not appear to work! Is there something I am missing?

You have a bug in some other code than in setting the color.

Please create a new form with a single button and test my code there. Trying to do many things at once often means achieving nothing.

You are right. I was calling this to get my control:
object = myForm.control(object_id())
but what I needed to call was:
object = myForm.design().control(object_id())

A couple questions:

  1. Do you know the difference between myForm.control() and myForm.design().control()? The former seemed to have read access to the controls, but not write access.
  2. Everything seems to be working for me now, except that I cannot change the colors of the controls on the actionpane. I’ve read that is because they are restricted intentionally. I CAN change some properties (eg the label). Do you know if there is a list of properties that can be changed for actionpane buttons? Anything you would recommend for this case?

I can’t reproduce your problem. This code works just fine for me:

FormButtonControl b = element.control(button1.id());

b.colorScheme(FormColorScheme::RGB);
b.backgroundColor(WinAPI::RGB2int(255, 255, 0));

Action panes are special - you define what should be there; you can’t do much about how AX will render it. I don’t have any list of such properties.