Page MenuHomeFeedback Tracker

[Feature Request] New scripting command: CtrlTextColor
Need More Info, NormalPublic

Description

There's no command for returning the text color of a control.

Details

Severity
Feature
Resolution
Open
Reproducibility
N/A
Operating System
Windows 7
Category
Feature Request

Event Timeline

Leopard20 created this task.Sep 1 2020, 4:16 AM
BIS_fnc_KK changed the task status from New to Assigned.

Could you tell me why would you need this and how it can be useful in general? there are only a few color getters for controls, mostly color setters, so I'd like to know how useful this could be and possible uses that could benefit everyone.

BIS_fnc_KK changed the task status from Assigned to Need More Info.Sep 3 2020, 7:10 AM
Leopard20 added a comment.EditedSep 3 2020, 8:01 AM

For example, what I'm working on involves something like this:


This is a "color picker" that allows you to change the color of some control elements. You can select a color on the left, and it changes preview and color properties on the right.

Right now the process of getting the color is a bit laborious:

When the user selects a control whose color is to be changed, the preview image must be updated:

  1. Read the button texture using ctrl getVariable ["text", ctrlText ctrl] (the reason for getVar is because of this bug: T153510)
  2. Extract the color from texture (using splitString and parseNumber)
  3. Apply the color to the preview.

When a color from the left side is selected, both the preview image and the original control must be updated:

  1. Read the button texture using ctrlText
  2. Extract the color from texture (using splitString and parseNumber)
  3. Apply the color to the preview.
  4. Apply the color to the original ctrl as a texture ctrl ctrlSetText text; ctrl setVariable ["text", text]

But if I could just read the colors, it would be a lot more convenient.

Granted, this is a really special case but there are other uses as well.

But if it's too hard to implement, it's okay to ignore this because it is not really high priority for me (as you can see there's a workaround)

DrSova added a subscriber: DrSova.Sep 4 2020, 3:00 PM
BIS_fnc_KK removed BIS_fnc_KK as the assignee of this task.Nov 24 2020, 6:14 PM
BIS_fnc_KK added a subscriber: BIS_fnc_KK.