[Implemented] Remove CreateGadgetList()
[Implemented] Remove CreateGadgetList()
How about removing CreateGadgetList()? In the rare case you want to open a window without gadgets, does it matter if a few bytes are wasted?
And what about merging OpenGadgetList() and UseGadgetList()? They do basically the same except with gadgets and windows. Illogically one takes a PB number and the other one takes an ID. If both used the ID they could be merged into one function.
And what about merging OpenGadgetList() and UseGadgetList()? They do basically the same except with gadgets and windows. Illogically one takes a PB number and the other one takes an ID. If both used the ID they could be merged into one function.
-
- Enthusiast
- Posts: 289
- Joined: Mon Apr 02, 2007 7:22 am
- Location: Finland
Re: Remove CreateGadgetList() and merge OpenGadgetList()
I find that's a cool idea! Although it doesn't need much typing to write CreateGadgetList(), it's still quite annoying to do it for every window you want to have some Gadgets in it. In most other programming languages that I know, there is a similar function usually named InitWidget, etc..Trond wrote:How about removing CreateGadgetList()? In the rare case you want to open a window without gadgets, does it matter if a few bytes are wasted?
Cute?
What sense does it make that CreateGadgetList() acceptss hWnd's only? You cannot create gadgets onto other windows, so it would be good, if CreateGadgetList() just accepts #WindowID's.
I tried to create gadgets onto other windows (not owned by my program, but it didn't worked.
(Sorry, if I'm wrong)
I tried to create gadgets onto other windows (not owned by my program, but it didn't worked.
(Sorry, if I'm wrong)
PB 4.30
Code: Select all
onErrorGoto(?Fred)
> You cannot create gadgets onto other windows
Trond posted something here where he added a button to an external window:
http://www.purebasic.fr/english/viewtopic.php?t=13411
Also, I remember reading that CreateGadgetList can be used to create many
lists, not just one, so the user can select which list to use at any given time,
so I think that's why the command exists.
Trond posted something here where he added a button to an external window:
http://www.purebasic.fr/english/viewtopic.php?t=13411
Also, I remember reading that CreateGadgetList can be used to create many
lists, not just one, so the user can select which list to use at any given time,
so I think that's why the command exists.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
"PureBasic won't be object oriented, period" - Fred.
@ PB:
Sorry, didn't know that it's so easy:
iirc, I tried the same, but I've failed... 
Sorry, didn't know that it's so easy:
Code: Select all
c=FindWindow_(0,"Calculator")
CreateGadgetList(c)
ButtonGadget(0,0,0,100,20,"test")

PB 4.30
Code: Select all
onErrorGoto(?Fred)
Because your program then ends and PB destroys the button before you can see it...AND51 wrote:@ PB:
Sorry, didn't know that it's so easy:iirc, I tried the same, but I've failed...Code: Select all
c=FindWindow_(0,"Calculator") CreateGadgetList(c) ButtonGadget(0,0,0,100,20,"test")
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
You can't do that. You can't process the window messages for an unowned window. The best you could do is create a borderless window the size of the gadget and have it move with the target app, creating the illusion that you've put a gadget on it. There is a post from the team dealing with this:
http://www.purebasic.fr/english/viewtopic.php?t=7758
http://www.purebasic.fr/english/viewtopic.php?t=7758
BERESHEIT
Re: Remove CreateGadgetList() and merge OpenGadgetList()
> How about removing CreateGadgetList()? In the rare case you want to
> open a window without gadgets, does it matter if a few bytes are wasted?
I don't get it. If you're going to open a window without gadgets, then you
wouldn't need to call CreateGadgetList at all, so what's the problem here?
Isn't that like saying: remove DeleteFile because my app won't be deleting
any files?
> open a window without gadgets, does it matter if a few bytes are wasted?
I don't get it. If you're going to open a window without gadgets, then you
wouldn't need to call CreateGadgetList at all, so what's the problem here?
Isn't that like saying: remove DeleteFile because my app won't be deleting
any files?
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
"PureBasic won't be object oriented, period" - Fred.
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
I think it would be cleaner and less coding if every window you opened automatically came with a gadgetlist unless you passed the flag #PB_Window_NoGadgetList, which you'd only do infrequently. It would save typing the CreateGadgetlist(Windowid(0)) every time you open a window. But the command is still needed for API-created windows, so it can't really be retired.
BERESHEIT