ListIconGadget lock the first column

Just starting out? Need help? Post your questions and find answers here.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5631
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

ListIconGadget lock the first column

Post by Kwai chang caine »

Hello at all

It is possible to lock the first column or the first row like excel ???
I don't say that in english, but in french is "Figer les volets" with the google traductor "Freeze panes"

Image

When i move the horizontal scrollBar, the first column stay in left of the listicon and the other column slips below.
And for the row, when i move the vertical scrollBar the first row stay in the top of the listicon and the other row slips below.

Thanks for your help
Good day
ImageThe happiness is a road...
Not a destination

PureBasic French Forum
User avatar
Fluid Byte
Addict
Addict
Posts: 2336
Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany

Post by Fluid Byte »

Code: Select all

Procedure WindowCallback(hWnd,uMsg,wParam,lParam)
	Select uMsg
		Case #WM_NOTIFY
		*lpnm.NMHDR = lParam
		
		If *lpnm\hwndFrom = SendMessage_(GadgetID(0),#LVM_GETHEADER,0,0) And *lpnm\code = #HDN_BEGINTRACK
			*nmh.NMHEADER = lParam

			If *nmh\iItem = 0	: ProcedureReturn 1 : EndIf
			
			ProcedureReturn 0
		EndIf
	EndSelect
	
	ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure

OpenWindow(0,0,0,320,240,"void",#PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CreateGadgetList(WindowID(0))
ListIconGadget(0,0,0,320,240,"Name",160)
AddGadgetColumn(0,1,"Type",80)
AddGadgetColumn(0,1,"Size",60)

SetWindowCallback(@WindowCallback())

While WaitWindowEvent() ! #PB_Event_CloseWindow : Wend
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5631
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Post by Kwai chang caine »

Thankks FLUID BYTE for your quick answer 8)

I'm a sheet :oops:
I've forgotten the code in my first POST for understand better my question.

I have add your code and mine.
And that's not works :cry:

If i move the horizontal scrollBar, the first column (Name) stay in left of the listicon and the other column (value) slips below the "Name" column :D .

Code: Select all

Procedure WindowCallback(hWnd,uMsg,wParam,lParam) 
   Select uMsg 
      Case #WM_NOTIFY 
      *lpnm.NMHDR = lParam 
       
      If *lpnm\hwndFrom = SendMessage_(GadgetID(0),#LVM_GETHEADER,0,0) And *lpnm\code = #HDN_BEGINTRACK 
         *nmh.NMHEADER = lParam 

         If *nmh\iItem = 0   : ProcedureReturn 1 : EndIf 
          
         ProcedureReturn 0 
      EndIf 
   EndSelect 
    
   ProcedureReturn #PB_ProcessPureBasicEvents 
EndProcedure 

If OpenWindow(0,50,50,600,100,"ListIcon Example",#PB_Window_SystemMenu|#PB_Window_ScreenCentered) 

 If CreateGadgetList(WindowID(0)) 
  ListIconGadget(0,5,5,590,90,"Name",100) 
  AddGadgetColumn(0,1,"value",80) 
  AddGadgetColumn(0,2,"Value",80) 
  AddGadgetColumn(0,3,"Value",80) 
  AddGadgetColumn(0,4,"Value",80) 
  AddGadgetColumn(0,5,"Value",80) 
  AddGadgetColumn(0,6,"Value",80) 
  AddGadgetColumn(0,7,"Value",80) 
  AddGadgetColumn(0,8,"Value",80) 
  AddGadgetItem(0,-1,"Titre"+Chr(10)+"First value"+Chr(10)+"Second value"+Chr(10)+"Third value"+Chr(10)+"value 4"+Chr(10)+"value 5"+Chr(10)+"value 6"+Chr(10)+"Last value") 
  SetWindowCallback(@WindowCallback()) 
     
  Repeat 
   EventID = WaitWindowEvent()
  Until EventID = #PB_Event_CloseWindow And EventWindow() = 0 
  
 EndIf 
 
EndIf
Excuse me for my missing :oops:
ImageThe happiness is a road...
Not a destination

PureBasic French Forum
User avatar
Fluid Byte
Addict
Addict
Posts: 2336
Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany

Post by Fluid Byte »

Ah ok, now I see what you mean. Well, I am sorry but this is not possible with a standard header control. You have to create your own gadget wich I guess will be a lot of work.
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5631
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Post by Kwai chang caine »

With this fonction...the array excell as the first column or/and the first row like a title of a array.

For example this is an excel file with the first column AND row freezed
http://purebasic.myftp.org/files/413/Freeze_fanes.xls
ImageThe happiness is a road...
Not a destination

PureBasic French Forum
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5631
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Post by Kwai chang caine »

Ah ok, now I see what you mean. Well, I am sorry but this is not possible with a standard header control. You have to create your own gadget wich I guess will be a lot of work.
Create my grid gadget :lol: :lol: :lol:
I just know how open the IDE PUREBASIC :lol: :lol:
I go to learn, how i can do, without this function, its more possible :D

Thanks sincerely for your help 8)
ImageThe happiness is a road...
Not a destination

PureBasic French Forum
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

As Fluid said, this is not possible with a ListIcon.

One way to accomplish something similar would be to use a second ListIcon containing just one column which you position alongside the main listicon etc. This would involve quite a bit of work though to keep the two gadgets in synch with each other and also to synchronise row selection etc. And before you ask, no way am I going to attempt creating such an example for you! :wink: Although I did something similar with two EsGRID controls a while back!
I may look like a mule, but I'm not a complete ass.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5631
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Post by Kwai chang caine »

And before you ask, no way am I going to attempt creating such an example for you! Although I did something similar with two EsGRID controls a while back
I think I'll have said already,................. but you're a mother to me :D
ImageThe happiness is a road...
Not a destination

PureBasic French Forum
PurePi
New User
New User
Posts: 5
Joined: Thu Nov 06, 2008 10:57 pm
Location: Hamburg

Post by PurePi »

have a look at Xombie's work (it`s a Grid object called XLIST)
Xombie has just implemented a function to "Freeze Colums"

http://www.purebasic.fr/english/viewtop ... 2&start=30

regards
Bernd
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> I'm a sheet :oops:

:lol: I love it! :D
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5631
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Post by Kwai chang caine »

Glad to make you a smile :D
ImageThe happiness is a road...
Not a destination

PureBasic French Forum
Post Reply