![]() |
making a custom GUI button - help
i need some help in making a custom button. so far the only way i have figured to work is using GuiBitmapButtonCtrl. if there is another way please tell me (like a different function or anything really). if not then does the image need to be a certain size or something? like if it needs to be 32x32. is it also possible to resize it? like i would using parth partx etc for other GUI images.
here is my current attempt. (it's halved) PHP Code:
|
Firstly, I'm not sure why you have the 4 ending brackets at the end of your script, when you only have one opening bracket.
And here's a tip, when you're scripting, make sure your starting brackets and the ending brackets line up. Makes it much easier to debug your code. PHP Code:
To further answer you question, I suggest you remove extent and position. Also, even though you define them as arrays you can't access them as arrays, so you should do extent = "123 321"; instead. (What I mean by that you can't access them as arrays, is that there is currently no support for reading the first value of for example extent, by using extent[0] - atleast this is what the wiki states) Instead of extent and position I suggest you use resize(x, y, width, height); This will place your guicontrol at x and y (relative to the parent gui control if it's a child. If this is the parent gui control, use screen coordinates) and resize the width and height to the values specified respectively. And the use of partx, party, partw, parth is for clipping the image, using only a section of the image: GuiControls don't really use partx, party etc etc besides GuiShowImgCtrl and GuiDrawingPanel, I suggest you use this instead: PHP Code:
The array values are as follows: NPC Code: -- If you have any more questions or wondering about something else, just ask :) |
thanks for the help, really appreciated. you know i saw resize but i guess i just took it for granted. it's nice compacting the script like that.
but at any rate, i'm still having an issue with the button. the image shows up, but it shows up odd. like all the colors and graphics are squished into each other. Even when i resize it and make the window bigger to look at it as a whole; it looks odd. how do i fix that? also i was playing with bitmaprectangle, and i could be using it wrong, but it didn't even so much as budge the button. at least from what it seemed. so far the only thing that works the way i want it to on the button. is when i press it. when i do that it works fine but i need a bit more then that though. thanks again for the help i may need some more unfortunately. basically just trying to resize the button and make it look like the way it should is my key issue. |
Quote:
|
Quote:
|
PHP Code:
|
khortez, please style your code before posting it. It's difficult for us to read your code if it's not styled properly. You should be indenting your code as you write it, but if you find that impossible, use Jer's GS2 Beautifier before you post. This is the third time in the past 3 days you've posted poorly-formatted code. It just makes it harder for us to help you (look at Chompy's first post above to see why).
Thanks. |
Quote:
i'll try it again however: PHP Code:
|
Looks like you're missing a curly bracket to me at the end of your code.
|
i apologize if it's hard to read everyone, i'll continue trying to make it easier for you all. still thanks for the help. as for the brackets; idk the code works fine for me/RC hasn't complained to me about anything. just i still can't get the image to look exactly the way i want it.
|
I'd recommend creating the button in a GuiWindowCtrl within onCreated. There's no need to destroy the button every time; just hide it (obj.visible = false).
|
1 Attachment(s)
Quote:
alright i'ma remake the code and try to give you guys a picture example of what i'm trying to fix. the picture i provided is exactly what it looks like. of course i use a different image in the script but thats overall what it looks like; it gets the entire thing and puts it on the map like that and it looks nothing like a button. i can press it like a button and it'll do stuff. but it doesn't look the part at all. and i dunno how to resize it. i used different methods, even some said here but it didn't do anything. i'll try the ones mentioned here again though. now that i remade the code hopefully ill get a better look at it and see if i shoulda done something different. other then that any way of fixing that via script? edit: ahh i think i mighta found a way actually. ill try this then. still any helpful comments/input etc is appreciated. thanks all editx2: Nope. nevermind what i did, i thought would work but it did not. back to square one. any help please? lol also emera you was right, in that last script i was missing a bracket. noticed it when i tried reusing the code in a different weapon. not sure how it got deleted though. it was there before. anyway thanks |
| All times are GMT +2. The time now is 05:39 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.