Page 1 of 1
ListIconGadget
Posted: Thu Mar 22, 2012 10:19 am
by jamirokwai
Hi there,
I'd like to ask for two new commands for ListIconGadget and such.
On Windows, you may use API-commands, but I don't use Windows anymore.
All functions should be cross platform
GetGadgetColumnCount(GadgetID) ; Count the Columns of a ListIconGadget
CountGadgetSelectedItems(GadgetID) ; Count the selected Lines (!) of a ListIconGadget
We can do both using PB already, but it would be great to have these commands.
Example for GetGadgetColumnCount (yes, could do better, but I needed the names of the columns
Code: Select all
j = 0
Repeat
temp$ = GetGadgetItemText(GadgetID,-1,j)
If temp$ <> ""
j + 1
EndIf
Until temp$ = ""
The count of columns in this ListIconGadget would be set in variable 'j'.
Re: ListIconGadget
Posted: Thu Mar 22, 2012 2:10 pm
by bembulak
Good idea! +1
Re: ListIconGadget
Posted: Thu Mar 22, 2012 4:30 pm
by Tenaja
Sounds good! +1
There are quite a few ListIcon functions that would be very helpful, but must be done manually.
Re: ListIconGadget
Posted: Fri Mar 23, 2012 12:22 am
by Andre
+1
Furthermore sorting the ListIcon contents by selecting a column should be possible.
And showing a specific (selected) item of the ListIcon.
Re: ListIconGadget
Posted: Fri Mar 23, 2012 2:10 am
by Tenaja
Andre wrote:+1
Furthermore sorting the ListIcon contents by selecting a column should be possible.
And showing a specific (selected) item of the ListIcon.
I would be happy with a Gadget Event when the column heading was clicked. That would allow us to perform a sort, or any other number of actions.
Re: ListIconGadget
Posted: Sat Mar 01, 2014 5:03 pm
by Michael Vogel
+1
I would also like to have a PB command instead of using SendMessage_(Gadget,#LVM_GETSELECTEDCOUNT,0,0)
Re: ListIconGadget
Posted: Sun Mar 02, 2014 2:02 am
by PB
> GetGadgetColumnCount(GadgetID) ; Count the Columns of a ListIconGadget
A command for this isn't needed because you created them, so
you already know how many there are. You kept the number in
a variable, right?

Re: ListIconGadget
Posted: Sun Mar 02, 2014 3:56 am
by wombats
PB wrote:> GetGadgetColumnCount(GadgetID) ; Count the Columns of a ListIconGadget
A command for this isn't needed because you created them, so
you already know how many there are. You kept the number in
a variable, right?

One could say the same for CountGadgetItems().

Re: ListIconGadget
Posted: Sun Mar 02, 2014 12:55 pm
by Michael Vogel
wombats wrote:PB wrote:> GetGadgetColumnCount(GadgetID) ; Count the Columns of a ListIconGadget
A command for this isn't needed because you created them, so
you already know how many there are. You kept the number in
a variable, right?

One could say the same for CountGadgetItems().

...and for GadgetState and ... and ...
...but why not implementing something like CountGadgetSelectedRows() ?
Re: ListIconGadget
Posted: Sun Mar 02, 2014 1:15 pm
by STARGÅTE
CountGadgetItems(#Gadget[, Flags)]
With flags:
- #PB_ListIcon_Columns
- #PB_ListIcon_Selected
- #PB_ListIcon_Checked
Re: ListIconGadget
Posted: Sun Mar 02, 2014 11:02 pm
by PB
> One could say the same for CountGadgetItems()
Counting gadget items is dynamic. Creating a gadget is a one-off job.
Re: ListIconGadget
Posted: Mon Mar 03, 2014 2:09 pm
by BorisTheOld
PB wrote:> GetGadgetColumnCount(GadgetID) ; Count the Columns of a ListIconGadget
A command for this isn't needed because you created them, so
you already know how many there are. You kept the number in
a variable, right?

Using one's own variables to track the application's status is very basic stuff.
Structures, arrays, lists and maps, can be used to hold such information and are far more useful than any command PB might provide.
Sigh.....Do people write real programs any more?

Re: ListIconGadget
Posted: Mon Mar 03, 2014 6:41 pm
by Michael Vogel
Another brilliant idea to keep things twice in memory, in an array/list and the dialog structures
Certainly it's possible to create our own functions to get the needed results or to use system functions of Windows. Eventually, we shouldn't ask for new functions but think about which PB functions could be eliminated in the next PB releases, starting with functions, like GadgetID(), WinID, ImageID() etc.
Maybe “real programs“ are using [>,+_.] solely

Re: ListIconGadget
Posted: Mon Mar 03, 2014 11:00 pm
by PB
> think about which PB functions could be eliminated in the next PB releases,
> starting with functions, like GadgetID(), WinID, ImageID()
Hehehe.

For the record, I don't even use GadgetID() and such, but my own
variable with the return value of its creation, which is, yep, the gadget ID.
Using GadgetID() in your code over and over actually makes it run a tad slower
than just referencing a variable, because of the constant runtime evaluation.
The speed difference is very minimal, but still, it's there and it bothers me.
Code: Select all
OpenWindow(0,100,100,100,100,"")
bg=ButtonGadget(0,10,10,80,80,"")
start=ElapsedMilliseconds()
For a=1 To 20000000 : b+GadgetID(0) : Next
Debug ElapsedMilliseconds()-start ; 2632 ms
start=ElapsedMilliseconds()
For a=1 To 20000000 : b+bg : Next
Debug ElapsedMilliseconds()-start ; 2196 ms
Re: ListIconGadget
Posted: Tue Mar 04, 2014 7:49 am
by Michael Vogel
PB wrote:
Hehehe.

For the record, I don't even use GadgetID() and such, but my own
variable with the return value of its creation, which is, yep, the gadget ID.
That's what I do as well (as for windows and image ID's), but it's fine that those ID functions exist
Back to a feature for which was asked for -- I would think, that an internal (OS independent) PB function for retrieving the number of selected list items is not only more comfortable but also faster than any self made code (wether variables are used or not) -- wouldn't you think so?