GuiTextCtrl and mouse events, is it possible?
by Dmitriy Stukalov · in Torque Game Builder · 08/30/2007 (1:08 am) · 6 replies
Hello,
Probably it is very stupid question, but it make me creasy!
Is it possible to change the color of GuiTextCtrl when the mouse move over control? I've not found any information inside TDN.
Edit:
I've tryed the code below...
Probably it is very stupid question, but it make me creasy!
Is it possible to change the color of GuiTextCtrl when the mouse move over control? I've not found any information inside TDN.
Edit:
I've tryed the code below...
function MyTextCtrl::onMouseEnter(%this, %modifier, %worldPosition, %clicks)
{
MyTextCtrl.fontColor = $color_red; // $color_red = "255 0 0";
}...but unsuccessfully.
#2
I've found the article Invisible Buttons. It is really helpful for me. But, is it really impossible to get mouse events for TextCtrl's?
08/30/2007 (3:39 am)
Thank you Phillip,I've found the article Invisible Buttons. It is really helpful for me. But, is it really impossible to get mouse events for TextCtrl's?
#3
I could be wrong, however.
08/30/2007 (4:26 am)
The problem is that most guictrls dont have mouse events scripted (to the best of my knowledge). If you really wanted to do it, I would think that you'd have to modify the source.I could be wrong, however.
#4
1. There is GUI type GuiMouseEventCtrl for catch mouse events.
2. The aricle Adding Mouse Events to Gui Controls. As Phillip wrote it require to modify the source.
Edit: URL
08/31/2007 (1:22 am)
I've found a couple of interesting things.1. There is GUI type GuiMouseEventCtrl for catch mouse events.
2. The aricle Adding Mouse Events to Gui Controls. As Phillip wrote it require to modify the source.
Edit: URL
#5
08/31/2007 (9:00 pm)
I have been playing with this and you can get it to work using GuiMouseEventCtrl.function txtWelcome2_mouse::onMouseEnter(%this, %modifier, %worldPosition, %clicks)
{
$txtWelcome2::original_profile = txtWelcome2.Profile;
txtWelcome2.Profile = "GuiText24CuckooBlackProfile";
echo("txtwelcome_mouse_enter");
}
function txtWelcome2_mouse::onMouseLeave(%this, %modifier, %worldPosition, %clicks)
{
txtWelcome2.Profile = $txtWelcome2::original_profile;
echo("txtwelcome_mouse_leave");
}
// Gui Code **
new GuiTextCtrl(txtWelcome2) {
canSaveDynamicFields = "0";
isContainer = "0";
//Profile = "GuiText24CuckooBlackProfile";
Profile = "GuiText24CuckooOrangeProfile";
HorizSizing = "center";
VertSizing = "bottom";
Position = "40 40";
Extent = "269 38";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
text = "Welcome, Stanley12345";
useMouseEvents = "1";
maxLength = "1024";
};
new GuiMouseEventCtrl(txtWelcome2_mouse) {
canSaveDynamicFields = "0";
isContainer = "0";
Profile = "GuiTransparentProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "40 40";
Extent = "269 38";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
lockMouse = "0";
};
//Your store color info in different profiles
new GuiControlProfile (GuiText24CuckooOrangeProfile : GuiTextProfile)
{
fontType="Cuckoo";
fontSize = 24;
fontColor = "247 90 0";
fixedExtent = true;
justify = "center";
};
new GuiControlProfile (GuiText24CuckooWhiteProfile : GuiTextProfile)
{
fontType="Cuckoo";
fontSize = 24;
fontColor = "255 255 255";
fixedExtent = true;
justify = "center";
};
new GuiControlProfile (GuiText24CuckooBlackProfile : GuiTextProfile)
{
fontType="Cuckoo";
fontSize = 24;
fontColor = "0 0 0";
fixedExtent = true;
justify = "center";
};
Associate Phillip O'Shea
Violent Tulip