Comments (6)
getSize would make sence for both without the text or with the text, but the problem is that setSize only makes sence for the image.
So I would have to make the getSize function return the whole size and the setSize function only change the size of the image. Or make them both work on the size including both image and text, but this is a bit tricky. (first solution looks better)
Neither solution seems really good, but leaving it like it is ain't great either.
Any suggestions?
from tgui.
I think that having the two functions working on the full size (image+text) is more logical, imho. In the most of the cases, the widget will normally be kept auto sized by the user.
You can also add get/setBoxSize functions...
from tgui.
Maybe it is more logical, but there are a lot of things to look at.
What happens with the text when you set the size of the checkbox? Are you just going to clip it?
When you change the text after setting the size, are you going to reset the clipping? This would actually be nice, but then you get different behaviour if you change the order of setSize and setText function calls. And if you don't reset the clipping then you basically have to know the size of the text upfront.
I actually agree that your solution with having both set- and getSize work on the full size and add get/setBoxSize function might be the best, but I just don't like the fact that there doens't seems to be a clean solution and that whatever I do there will always be pitfalls.
from tgui.
Yes, I think that the checkbox should be clipped, and when the text is changed you should keep the clipping. You can perhaps add a setAutoSize() function, but I don't think is very important. If someone use setSize, it will know what he does, so he won't use setAutoSize(true) after I think.
from tgui.
Alright, I'll make the changes (tomorrow).
In the end, normally you'll have an image of the correct size anyway.
from tgui.
I actually did implement the clipping and setBoxSize function, but I really don't like it. It makes CheckBox unnecessary more difficult. Also the clipping would make it slightly slower. And that all for a setSize function that probably isn't going to be used anyway.
So I'm going to do it in another way. For now I'm just going to fix this issue by making the changes in the getSize function. As long as you don't use the setSize function there won't be a real difference and I don't have to add functions to CheckBox and a lot of extra code in the draw function.
But I have the full changes with clipping and get- and setBoxSize function on a seperate local branch, so if I later would have to make this changes then I will be able to do so instantly.
from tgui.
Related Issues (20)
- Setting a widget's index in a layout doesn't seem to update it until the layout is resized HOT 1
- A Few SubwidgetContainer Issues HOT 4
- Ability to Rename MessageBox Buttons HOT 3
- Gamepad support? HOT 5
- Autocomplete support for EditBox HOT 2
- Can not input CJK words HOT 9
- Black background shown when changing window size HOT 4
- How to customize the window's title bar and frame HOT 2
- How to implement a polygon window HOT 2
- Hover style does not disappear when mouse moves out of the window HOT 6
- Add a 2d chart or rendering 3d data for TGUI? HOT 1
- Chinese support? HOT 5
- Focus Issues HOT 1
- [ANNOUNCE] The TGUI now distributed via MSYS2 on Windows HOT 1
- CMake fails to install pkg-config files HOT 2
- On macOS, Input Method Editors(IME) behavior seems incorrect. HOT 6
- How to use SDL2/3 backend with cmake `FetchContent` HOT 2
- [Question] How to compile my first example of TGUI ? HOT 13
- [Bug] Dead radio button text HOT 3
- [Bug] Tabs state after disabled tab click HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tgui.