Page 1 of 1

ListIconGadget lock the first column

Posted: Tue Sep 30, 2008 12:47 pm
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

Posted: Tue Sep 30, 2008 1:00 pm
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

Posted: Tue Sep 30, 2008 1:12 pm
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:

Posted: Tue Sep 30, 2008 1:22 pm
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.

Posted: Tue Sep 30, 2008 1:38 pm
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

Posted: Tue Sep 30, 2008 1:42 pm
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)

Posted: Tue Sep 30, 2008 1:45 pm
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!

Posted: Tue Sep 30, 2008 2:24 pm
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

Posted: Wed Nov 26, 2008 12:56 pm
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

Posted: Wed Nov 26, 2008 2:57 pm
by PB
> I'm a sheet :oops:

:lol: I love it! :D

Posted: Wed Nov 26, 2008 4:32 pm
by Kwai chang caine
Glad to make you a smile :D