Modify ListViewGadget - can it be done

Just starting out? Need help? Post your questions and find answers here.
RamRat
User
User
Posts: 20
Joined: Mon Nov 14, 2016 9:58 am
Location: Oz

Modify ListViewGadget - can it be done

Post 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!
:shock:
RamRat
User
User
Posts: 20
Joined: Mon Nov 14, 2016 9:58 am
Location: Oz

Re: Modify ListViewGadget - can it be done

Post 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 ?
:shock:
PureLust
Enthusiast
Enthusiast
Posts: 486
Joined: Mon Apr 16, 2007 3:57 am
Location: Germany, NRW

Re: Modify ListViewGadget - can it be done

Post 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.
[Dynamic-Dialogs] - create complex GUIs the easy way
[DeFlicker] - easily deflicker your resizeable Windows
[WinFX] - Window Effects (incl. 'click-through' Window)
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 5032
Joined: Sun Apr 12, 2009 6:27 am

Re: Modify ListViewGadget - can it be done

Post 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
Last edited by RASHAD on Wed Dec 28, 2016 10:47 pm, edited 1 time in total.
Egypt my love
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Modify ListViewGadget - can it be done

Post by IdeasVacuum »

You might find it easier to achieve with a ListIcon
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 5032
Joined: Sun Apr 12, 2009 6:27 am

Re: Modify ListViewGadget - can it be done

Post by RASHAD »

Previous post updated
Egypt my love
RamRat
User
User
Posts: 20
Joined: Mon Nov 14, 2016 9:58 am
Location: Oz

Re: Modify ListViewGadget - can it be done

Post 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!
Last edited by RamRat on Thu Dec 29, 2016 3:22 am, edited 1 time in total.
:shock:
RamRat
User
User
Posts: 20
Joined: Mon Nov 14, 2016 9:58 am
Location: Oz

Re: Modify ListViewGadget - can it be done

Post 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!
:shock:
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Modify ListViewGadget - can it be done

Post 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.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Modify ListViewGadget - can it be done

Post 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.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Post Reply