selectable textdraws
#1

hi,

when i make textdraw selectable there is possibility to make the text cahnge its colour when you hover over the thextdraw with the mouse.
This works for me as long as i do not use ~r~ colour operators in that textdraw, in that case the hover effect will not work.
but i saw on a server that this is possible, to use ~r~ colours in the textdraw and also at the same time use the hover over effect of the mouse by making a textdraw selectable.

So how is it possible?
I tried to play around but never could get the effect for a textdraw where is used ~r~ colour operators in it...

please help
Reply
#2

You mean.. when textdraw color is red by using ~r~ specifier to make text color red, you can't hover it? Make sure that your color from SelectTextDraw is not red, because it won't show you that you hovered it with mouse.
Reply
#3

yes, thats what i mean.
Yes im sure its a different colour.
I used ~r~ red and yellow colour for the hover colour.

still dont know how to fix this...

Please help
Reply
#4

Looks like SA-MP issue for me.

Code that I've tested:
pawn Code:
#include    <a_samp>

new Text:gTextDraw;

public OnGameModeInit()
{
    gTextDraw = TextDrawCreate(10.000000, 141.000000, "MyTextDraw");
    TextDrawTextSize(gTextDraw,60.000000, 20.000000);
    TextDrawAlignment(gTextDraw,0);
    TextDrawBackgroundColor(gTextDraw,0x000000ff);
    TextDrawFont(gTextDraw,1);
    TextDrawLetterSize(gTextDraw,0.250000, 1.000000);
    TextDrawColor(gTextDraw,0xffffffff);
    TextDrawSetProportional(gTextDraw,1);
    TextDrawSetShadow(gTextDraw,1);
    TextDrawSetSelectable(gTextDraw, 1);
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys == KEY_SUBMISSION)
    {
        TextDrawSetString(gTextDraw, "~r~MyTextDraw");
        TextDrawShowForPlayer(playerid, gTextDraw);
        SelectTextDraw(playerid, 0x00FF00FF);
    }
    return 1;
}

public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
    if(clickedid == gTextDraw)
    {
         SendClientMessage(playerid, 0xFFFFFFAA, "You clicked on a textdraw.");
         CancelSelectTextDraw(playerid);
    }
    return 1;
}
Image:
http://bankfotek.pl/image/1668935 (I am actually hovering the textdraw there, but mouse has not been captured).

Note:
There are some other issues with ~r~ specifier anyway. Like displaying number '1' after '~r~' won't display the number. That must be SA-MPs issue, try ~h~~r~ and check what happens.
Reply
#5

thanks mate

I was aware of the other bugs u mentioned.
I also alreadey tried to light up the colours using ~h~'s but still the same.
I also assumed this was a SAMP issue but like for many SAMP related issues there might be also a getaround for this one.

Still no solution found for this...


I cant test it atm but do you think it was worth a try to create the textdraw without any ~r~ colour formatting and then use the colour formatting for that textdraw in TextDrawSetString AFTER it has been created?


thanks
Reply
#6

Quote:
Originally Posted by PawnoQ
View Post
thanks mate

I was aware of the other bugs u mentioned.
I also alreadey tried to light up the colours using ~h~'s but still the same.
I also assumed this was a SAMP issue but like for many SAMP related issues there might be also a getaround for this one.

Still no solution found for this...


I cant test it atm but do you think it was worth a try to create the textdraw without any ~r~ colour formatting and then use the colour formatting for that textdraw in TextDrawSetString AFTER it has been created?


thanks
You might try, but.. you want to keep that textdraw red all the time? If so.. why don't you just change Textdraws color to: 0xFF0000FF ?

Because, what you're saying now is just to create a textdraw and then just use TextDrawSetString, yes? That's what I did in code above (previous post).
Reply
#7

i want a red textdraw but i want it to change its colour when hovering over.
And hover effect doesnt work when using a colour formatting...

I just thought mabye the colour/text formatting is processed differently on textdraw creation then when it is when youre using TextDrawSetString...
Reply
#8

No. But, did it worked when you setted textdraw color to red by DEFAULT? Not by using TextDrawSetString? Because that might/should actually work. Only in case you want that textdraw to be ALWAYS red (but you can change its color by using TextDrawSetString to blue or something, but not using ~r~ for it again).
Reply
#9

that was the first thing i tried. Didnt work, what lead me to my latest experiments...

And yes, i also tried other colours.
Reply
#10

Quote:
Originally Posted by PawnoQ
View Post
that was the first thing i tried. Didnt work, what lead me to my latest experiments...

And yes, i also tried other colours.
Huh? How sure you're? I've did a test right now, and here is the result:
http://bankfotek.pl/image/1668959

As you may see, it works perfect. Left image is when I am hovering text, right is when I am not hovering it.
Reply
#11

what did you do, use some black magic? :P
I did try around for so long and never was able to get hover effect when i used a colour on my textdraw.
Can u give me the code pls.
Reply
#12

He? I've told you already, make your textdraw RED by DEFAULT (TextDrawColor)

pawn Код:
gTextDraw = TextDrawCreate(10.000000, 141.000000, "MyTextDraw");
    TextDrawTextSize(gTextDraw,60.000000, 20.000000);
    TextDrawAlignment(gTextDraw,0);
    TextDrawBackgroundColor(gTextDraw,0x000000ff);
    TextDrawFont(gTextDraw,1);
    TextDrawLetterSize(gTextDraw,0.250000, 1.000000);
    TextDrawColor(gTextDraw, 0xFF0000FF);
    TextDrawSetProportional(gTextDraw,1);
    TextDrawSetShadow(gTextDraw,1);
    TextDrawSetSelectable(gTextDraw, 1);
And just use different color for hovering? not red.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)