[Implemented] Remove CreateGadgetList()

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

[Implemented] Remove CreateGadgetList()

Post by Trond »

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.
codemaniac
Enthusiast
Enthusiast
Posts: 289
Joined: Mon Apr 02, 2007 7:22 am
Location: Finland

Re: Remove CreateGadgetList() and merge OpenGadgetList()

Post by codemaniac »

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?
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..
Cute?
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

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)
PB 4.30

Code: Select all

onErrorGoto(?Fred)
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> 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.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

@ PB:
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") 
iirc, I tried the same, but I've failed... :?
PB 4.30

Code: Select all

onErrorGoto(?Fred)
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

AND51 wrote:@ PB:
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") 
iirc, I tried the same, but I've failed... :?
Because your program then ends and PB destroys the button before you can see it...
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> Because your program then ends and PB destroys the button

Ahhhhhhhhhhhhh! :shock: So that's the reason! THANK YOU! :D
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

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
BERESHEIT
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: Remove CreateGadgetList() and merge OpenGadgetList()

Post by PB »

> 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?
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

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
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

Good idea about a #PB_Window_NoGadgetList flag for OpenWindow!
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

The flag sounds like a good solution.
Post Reply