ID:116321
 
Keywords: inter, library
I created this library because the use of winset was never very appealing to me. I wanted to share this with everyone else who had this little problem. It's not as complicated complex and awesome as forum_account's library (click the link if it's what you want) but it can be used without have code pre-generated. You simply have to bind this object to a client and a control.


Link: Interface Object


DOCUMENTATION YEAH!!!!

IMPORTANT NOTE: Leaving the arguments blank in the Parameter Proc called will make the proc return the
value of the parameter of the control

IMPORTANT NOTE 2: The return values are going to be either numbers, text, or a boolean(true or false, 0 or 1). So calling Control.FontSize() will return a number.

Naming Convention For Parameter's Proc:

The naming convention used isn't very complicated. All spaces and dashes(-) are removed,
instead the character that comes after them are capitalized. The first letter of the paremeter
is also capitalized. So to change the text on a label you would do something like so:
var/LabelControl/L = new("default.label1", client)
L.Text("blah")//sets the text to "blah"
var/v = L.Text()//L.Text() returns the label's text and sets the variable 'v' to the labe's text



Control Types:

CONTROL - Highest level of controls, does not include Macro or menu

MacroControl - Macros

MenuControl - Menus

LabelControl - Labels

BrowserControl - Browsers

WindowControl - Windows

TabControl - Tabs

ButtonControl - Buttons

InfoControl - Infos

InputControl - Inputs

OutputControl - Outputs

BarControl - Bars

ChildControl - Childs

GridControl - Grids


How it works:

- You may initialize a control by simply calling the bind(control, client) proc
The first argument is the control and the second is the client/mob(with a client)
- You can also initialize a control by supplying the arguments of bind in the control's
New proc e.g. var/LabelControl/L = new("somewindow.somecontrol", src)
Because winset() is soooo complicated.
@Cyberlord:


It is. It just doesn't feel right. Doing something like Label.Text(blah blah) feels more natural and is more object oriented. I'm trying to learn as many other languages as I can and they all use something similar to that, you won't find shit like winset in Java or other great other object oriented languages. I'm not the only one who has complained about this :)
I see where you're coming from, and kudos to you. Though I still deem it unnecessary in my book. To each their own though.
I was just complaining to him before he made the library. I think he more or so made it for interface noobs like me.

:D
ExPixel wrote:
I'm trying to learn as many other languages as I can and they all use something similar to that, you won't find shit like winset in Java or other great other object oriented languages. I'm not the only one who has complained about this :)

You should probably avoid C++ and the Win32 API if this is the case. The concept remains pretty close, but winset() really simplifies it quite a bit.
Audeuro wrote:

You should probably avoid C++ and the Win32 API if this is the case. The concept remains pretty close, but winset() really simplifies it quite a bit.

I don't really see anything wrong with making procedures do all of the work for you. It saves developmental time and for me, it keeps me from getting confused on what I have and haven't done. I'm a decent programmer, however, there's a TON of things I need to improve upon. One of those being interfaces. (oh and char handling :P)

Anyways, procedures are your friend!
I think this is an awesome idea. Among other things, doing everything with text strings is a lot of pointless repetition and a lot of chances to type something wrong in a way that won't show up as a compile-time error.

If this thing lets me type literal text that I want just like .Text("Howdy, y'all!") without having to do any escaping or 2params or whatever, then I declare it to be the best library ever and will start incorporating it into my project.
Audeuro wrote:
ExPixel wrote:
I'm trying to learn as many other languages as I can and they all use something similar to that, you won't find shit like winset in Java or other great other object oriented languages. I'm not the only one who has complained about this :)

You should probably avoid C++ and the Win32 API if this is the case. The concept remains pretty close, but winset() really simplifies it quite a bit.

I use C++ sometimes but I do stay away from Win32 API.
I haven't had a chance to download this yet, but from the example this looks very familiar :-)
Forum_account wrote:
I haven't had a chance to download this yet, but from the example this looks very familiar :-)

It is :)
Yusuke13 wrote:
I don't really see anything wrong with making procedures do all of the work for you. It saves developmental time and for me, it keeps me from getting confused on what I have and haven't done. I'm a decent programmer, however, there's a TON of things I need to improve upon. One of those being interfaces. (oh and char handling :P)

That's not the point- the point is that the win32 api is very widely used and its primary method of changing features about controls- SendMessage- is even more messed up than winset() is, and it is popular. With SendMessage, you actually have to have the numeric control (hwnd) of the control, the enumerated value for the property you want to change, then the proper WPARAM and LPARAM to change the value.
Audeuro wrote:
Yusuke13 wrote:
I don't really see anything wrong with making procedures do all of the work for you. It saves developmental time and for me, it keeps me from getting confused on what I have and haven't done. I'm a decent programmer, however, there's a TON of things I need to improve upon. One of those being interfaces. (oh and char handling :P)

That's not the point- the point is that the win32 api is very widely used and its primary method of changing features about controls- SendMessage- is even more messed up than winset() is, and it is popular. With SendMessage, you actually have to have the numeric control (hwnd) of the control, the enumerated value for the property you want to change, then the proper WPARAM and LPARAM to change the value.


If I ever decided to use win32 API I would probably cook up something similar to this for it as well.
You'd actually be better off going with something that's already made that does just that, such as Qt. I've seen dozens of home-rolled attempts to do such a thing, and they've all actually turned up incredibly ugly. The main problem is all of the tiny little details of the win32 api leaves a bunch of parameters hanging around everywhere that you either have to supply, give a default value, or assume a default value and provide a means of changing it.
Audeuro wrote:
You'd actually be better off going with something that's already made that does just that, such as Qt. I've seen dozens of home-rolled attempts to do such a thing, and they've all actually turned up incredibly ugly. The main problem is all of the tiny little details of the win32 api leaves a bunch of parameters hanging around everywhere that you either have to supply, give a default value, or assume a default value and provide a means of changing it.

Qt does sound better hehe.
Your blog's highlight-on-hover makes it a chore to read.
Toadfish wrote:
Your blog's highlight-on-hover makes it a chore to read.

Really? You're suppose to be able to see it regardless o.o
I can read it but I need to highlight to read comfortably. And once I highlight the contrast between the dark colors and the highlighted box is painful to the eyes.
Toadfish wrote:
I can read it but I need to highlight to read comfortably. And once I highlight the contrast between the dark colors and the highlighted box is painful to the eyes.

D:, color scheme 2 lied to me
ExPixel wrote:
It's not as complicated as forum_account's library

I'm not sure what this means. I suppose the internals of my library are more complicated but the way it's used is the same (call the proc and pass no arg to read it, pass an arg to set the value).

I downloaded your library and took a look, here are some comments:

1. Convert values to numbers if you know that's what they'll be. Button.FontSize() should return 0, not "0". You can also make Button.IsFlat() return 0 or 1 instead of "true" or "false" (if(Button.IsFlat() == "true") becomes if(Button.IsFlat()).

2. The Button's Text() proc is missing the third argument to doChange to tell it to enclose the value in quotes.

3. The bind() proc is good to have, but I'm not sure why the demo uses it so much. It'd be easier to create objects called button1, button2, button3, and button4 and bind them each to a button than to re-bind the same object every time you need to reference a button control. Doing it this way means you have to type the control's name over and over (each time is a potential typo) and it also means that accessing a button's property is always two lines (where winset/winget is just a single call).
Page: 1 2