Page 1 of 1

Modify ListViewGadget - can it be done

Posted: Wed Dec 28, 2016 1:47 pm
by RamRat
Hi,

Is there any way to have a ListViewGadget only show the Items and no scrollbar or border etc. or do I have to write my own?

I want this so I just see a list of items floating on screen that looks clean and simple, will be using my Surface Pro to flick
the list up/down or select item.

Cheers!

Re: Modify ListViewGadget - can it be done

Posted: Wed Dec 28, 2016 4:09 pm
by RamRat
Ok I have sussed the no border bit after searching the forum so now just need to get rid of the scrollbar

SetWindowLongPtr_(GadgetID(2), #GWL_EXSTYLE, GetWindowLongPtr_(GadgetID(2), #GWL_EXSTYLE)&~#WS_EX_CLIENTEDGE) ; NO BORDER !!!!

Is there a similar piece of code to get rid of the scrollbar or a modification to the above line ?

Re: Modify ListViewGadget - can it be done

Posted: Wed Dec 28, 2016 5:11 pm
by PureLust
Hi RamRat,

I made a little Demo of a TouchListControl a few years ago.
The code is a mess, because it was just to proof if and how easy it could be done.
Also I made a cleaned up version as include later on, but shame on me - I cannot find it anymore. :oops:

But maybe it's if some worth for you.
Hint: In Line 141 you should change '0.98' into '0.997' to get a better (Phone-like) scrolling experience.

Greetz, PL.

Re: Modify ListViewGadget - can it be done

Posted: Wed Dec 28, 2016 5:38 pm
by RASHAD
Hi

Code: Select all

LoadFont(0,"Tahoma",12)
If OpenWindow(0, 0, 0, 400, 200, "ListViewGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  SetWindowColor(0,$D3FFFF)
  ContainerGadget(0,10,10,380,175,#PB_Container_BorderLess)
    ListViewGadget(1, -1, -1, 402, 182)
  CloseGadgetList()
  SetGadgetFont(1,FontID(0))
  SetGadgetColor(1,#PB_Gadget_BackColor,$D3FFFF)
  For x = 1 To 30
    AddGadgetItem (1, -1, "Item " + Str(x) + " of the Listview")
  Next
  SetActiveGadget(1)
  SetGadgetState(1,0)

  Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
  EndIf
Edit :Modified

Re: Modify ListViewGadget - can it be done

Posted: Wed Dec 28, 2016 5:39 pm
by IdeasVacuum
You might find it easier to achieve with a ListIcon

Re: Modify ListViewGadget - can it be done

Posted: Wed Dec 28, 2016 10:47 pm
by RASHAD
Previous post updated

Re: Modify ListViewGadget - can it be done

Posted: Thu Dec 29, 2016 2:18 am
by RamRat
RASHAD wrote:Hi

Code: Select all


  ContainerGadget(0,10,10,380,175,#PB_Container_BorderLess)
    ListViewGadget(1, -1, -1, 402, 182)
  CloseGadgetList()
 
Edit :Modified
Awesome! Thanks mate. works just how I want 8) !

Now... :shock: does anyone have answers/ideas for ListViewGadget questions

1. It works fine on touchscreen BUT can it be forced to scroll smoother ?
2. When an item is selected can the selected items font change colour and not the background? (I tried "SetGadgetState(2,-1)" kinda works but doesn't remove all traces of item selection....)
3. Anyone have an idea how to hack a fadein/fadeout onto the top and bottom of the ListViewGadget

Cheers!

Re: Modify ListViewGadget - can it be done

Posted: Thu Dec 29, 2016 2:20 am
by RamRat
IdeasVacuum wrote:You might find it easier to achieve with a ListIcon
What is different with ListIcon that makes it easier? oh... will ListIcon provide a smoother scroll?

Cheers!

Re: Modify ListViewGadget - can it be done

Posted: Thu Dec 29, 2016 1:44 pm
by IdeasVacuum
No, it's simply that ListIcon is more often used, and thus whatever you want to do has probably been done before and the code posted on the forum. Take a look at RS Basic's Win API Lib, lots of Windows API for the ListIcon are documented there.
http://www.rsbasic.de/winapi-library/ You can download it too. ListIcon could be viewed as a 'plus' version of a ListView.

Re: Modify ListViewGadget - can it be done

Posted: Thu Dec 29, 2016 2:38 pm
by IdeasVacuum
For ListIon or ListView, it might be possible to control scroll smoothness using a SCROLLINFO structure. I have never done this myself but there is probably some code on the forum.