Page MenuHomeFeedback Tracker

[Bug] ctrlText returns the config value even if ctrlSetText is used
Closed, ResolvedPublic

Description

I have a control (CT_Button) with ST_PICTURE that uses a procedural texture like this:
text = "#(argb,8,8,3)color(1,1,1,1)";

I wanted to change its color, but since there's no ctrlTextColor command T153507 (I need the color for future calculations), I decided to overwrite the image with a new procedural texture using ctrlSetText.

The problem is, the command ctrlText seems to return the text in config no matter what I do (ctrlSetText appears to change the color instead of text)

Details

Severity
Minor
Resolution
Open
Reproducibility
Always
Operating System
Windows 7
Category
Scripting
Steps To Reproduce
  1. Create a display config with some control (ST_PICTURE):
class RscButton;
class MyDisplay {
	idd = 121212;  
	movingEnable = false;
	enableSimulation = true;
	controlsBackground[] = {};
	objects[] = {};
	class controls {
		class SomeCtrl: RscButton
		{
			idc = 1200;
			type = 1;
			style = 48;
			text = "#(argb,8,8,3)color(1,1,1,1)";
			x = safeZoneX + 0.5*safeZoneW - 0.1;
			y = safeZoneY + 0.5*safeZoneH - 0.1;
			w = 0.2;
			h = 0.2;
			colorText[] = {1,1,1,1};
			colorBackground[] = {1,1,1,1};
			colorFocused[] = {1,1,1,1};
			colorBackgroundActive[] = {1,1,1,1};
			offsetX = 0;
			offsetY = 0;
			colorDisabled[] = {0.3,0.3,0.3,0};
			colorBackgroundDisabled[] = {0.7,0.7,0.7,0};
			offsetPressedX = 0.002;
			offsetPressedY = 0.002;
			colorShadow[] = {0,0,0,0};
			shadow = 0;
			colorBorder[] = {0,0,0,1};
			borderSize = 0;
			soundEnter[] = {"",0.1,1};
			soundPush[] = {"",0.1,1};
			soundClick[] = {"",0.1,1};
			soundEscape[] = {"",0.1,1};
			font = "PuristaMedium";
			sizeEx = 0.04;
		};
	};
};
  1. Run this command in debug console:
[] spawn {
_d = findDisplay 46 createDisplay "MyDisplay";
_c = _d displayCtrl 1200;

sleep 2;

_c ctrlSetText "#(argb,8,8,3)color(1,0,0,1)";

hint ctrlText _c;
}

It still returns "#(argb,8,8,3)color(1,1,1,1)" as the text. However, you can clearly see that the control has turned red. So ctrlSetText has changed the color, not text.

Event Timeline

Leopard20 created this task.Sep 1 2020, 6:24 AM
Leopard20 updated the task description. (Show Details)Sep 1 2020, 6:46 AM
Leopard20 edited Steps To Reproduce. (Show Details)
Leopard20 updated the task description. (Show Details)Sep 1 2020, 6:55 AM
h- added a subscriber: h-.Sep 1 2020, 11:24 AM
BIS_fnc_KK changed the task status from New to Reviewed.

picture button is special case, so yes this is a bug

BIS_fnc_KK removed BIS_fnc_KK as the assignee of this task.Nov 24 2020, 6:10 PM
BIS_fnc_KK added a subscriber: BIS_fnc_KK.
BIS_fnc_KK changed the task status from Reviewed to Feedback.Jun 13 2021, 2:59 PM

fixed awhile ago

R3vo added a subscriber: R3vo.Jul 8 2021, 5:11 PM

Not fixed according to the repro. @BIS_fnc_KK @Leopard20

@R3vo Cannot confirm, works for me

R3vo closed this task as Resolved.Jul 9 2021, 4:11 PM
R3vo claimed this task.

My bad. Tested it again and yes, it works fine now.