Api Constant Value
Api Constant Value
Hello where can I get the Values of Constants used by the WindowsaApi.
For Example #WC_LISTVIEW?
			
			
									
									For Example #WC_LISTVIEW?
Apart from that Mrs Lincoln, how was the show?
						Re: Api Constant Value
'WC_LISTVIEW' is a window class that is used as a parameter of the 'CreateWindowEx()' API command. It's used basically to tell the command to create a list view gadget.Konne wrote:Hello where can I get the Values of Constants used by the WindowsaApi.
For Example #WC_LISTVIEW?
http://msdn.microsoft.com/library/defau ... _using.asp
Examples in the CodeArchiv. Controls with API a created by: 
see: http://msdn.microsoft.com/library/defau ... ndowex.asp
Constands for Controls mostly declared in: commctrl.h
			
			
									
									Code: Select all
CreateWindowEx_(Constands for Controls mostly declared in: commctrl.h
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

						Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

- netmaestro
 - PureBasic Bullfrog

 - Posts: 8452
 - Joined: Wed Jul 06, 2005 5:42 am
 - Location: Fort Nelson, BC, Canada
 
OK, why not, I'm bored anyway:Could someone show me an example how to create a Listview in PB via Api?
Code: Select all
colinfo.LV_COLUMN 
colinfo\mask = #LVCF_TEXT|#LVCF_WIDTH|#LVCF_FMT 
colinfo\fmt = #LVCFMT_LEFT 
colinfo\cx = 195 
colinfo\pszText = @"Column Header" 
hwnd = OpenWindow(0,0,0,320,300, "Listview API Demo",#PB_Window_SystemMenu|#PB_Window_ScreenCentered) 
lv=CreateWindowEx_(#WS_EX_CLIENTEDGE, "SysListView32", "MyListView",  #LVS_REPORT | #WS_CHILD | #WS_VISIBLE | #WS_HSCROLL | #WS_VSCROLL , 60,50,200,200,hwnd,0,GetModuleHandle_(0),0) 
SendMessage_(lv, #LVM_INSERTCOLUMN, 0, @colinfo) 
line.LV_ITEM 
line\Mask     = #LVIF_TEXT 
line\iItem    = 0 
line\iSubItem = 0  
line\pszText  = @"Line 1" 
SendMessage_(lv, #LVM_INSERTITEM, 0, @line) 
line\iItem    = 1 
line\iSubItem = 0  
line\pszText  = @"Line 2" 
SendMessage_(lv, #LVM_INSERTITEM, 0, @line) 
    
Repeat 
  EventID=WaitWindowEvent() 
Until EventID=#PB_Event_CloseWindow 
EndBERESHEIT
						netmaestro, I'm sure many people appreciate how you turn your moments of boredom into great instructional moments for us learners! Thanks!  
			
			
													
					Last edited by mskuma on Tue Aug 08, 2006 11:28 am, edited 1 time in total.
									
			
									
						- 
				techjunkie
 - Addict

 - Posts: 1126
 - Joined: Wed Oct 15, 2003 12:40 am
 - Location: Sweden
 - Contact:
 
Yeah!mskuma wrote:netmaestro, I'm sure many people appreciate how you turn your moments of boredom into great intructional moments for us learners! Thanks!

(\__/)
(='.'=) This is Bunny. Copy and paste Bunny into your
(")_(") signature to help him gain world domination.
Not all Constants are declared in PB.Kale wrote:'Alt-S' in the IDE.Konne wrote:So how do I have to write it in PB? Could someone show me an example how to create a Listview in PB via Api?
And is still the question is there a list of the Constant Values?
And thanks for the great example
Apart from that Mrs Lincoln, how was the show?
						I'm trying to Make a Row Editable like in the Api description but it doesn't work.
Here the Link to the message
http://msdn.microsoft.com/library/defau ... tlabel.asp
and here my code
			
			
									
									Here the Link to the message
http://msdn.microsoft.com/library/defau ... tlabel.asp
and here my code
Code: Select all
Procedure SetView(hwnd,View)  
   dwStyle=GetWindowLong_(Wnd, #GWL_STYLE); 
   SetWindowLong_(hwnd,#GWL_STYLE, (dwStyle & ~#LVS_TYPEMASK) | View)
EndProcedure
colinfo.LV_COLUMN
colinfo\mask = #LVCF_TEXT|#LVCF_WIDTH|#LVCF_FMT
colinfo\fmt = #LVCFMT_LEFT
colinfo\cx = 195
colinfo\pszText = @"Column Header"
hwnd = OpenWindow(0,0,0,320,300, "Listview API Demo",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
lv=CreateWindowEx_(#WS_EX_CLIENTEDGE, "SysListView32", "MyListView",  #LVS_REPORT | #WS_CHILD | #WS_VISIBLE | #WS_HSCROLL | #WS_VSCROLL , 60,50,200,200,hwnd,0,GetModuleHandle_(0),0)
SendMessage_(lv, #LVM_INSERTCOLUMN, 0, @colinfo)
line.LV_ITEM
line\Mask     = #LVIF_TEXT
line\iItem    = 0
line\iSubItem = 0 
line\pszText  = @"Line 1"
SendMessage_(lv, #LVM_INSERTITEM, 0, @line)
line\iItem    = 1
line\pszText  = @"Line 2"
SendMessage_(lv, #LVM_INSERTITEM, 0, @line)
SendMessage_(lv,#LVM_EDITLABEL,1,0);this isn't working ;(
Repeat
  EventID=WaitWindowEvent()
  
Until EventID=#PB_Event_CloseWindow
EndApart from that Mrs Lincoln, how was the show?
						- netmaestro
 - PureBasic Bullfrog

 - Posts: 8452
 - Joined: Wed Jul 06, 2005 5:42 am
 - Location: Fort Nelson, BC, Canada
 
OK, here's a working example of an editable listview control created in API. Just double-click any item to edit its contents:
			
			
									
									Code: Select all
Global editcontrol, edititem
colinfo.LV_COLUMN 
colinfo\mask = #LVCF_TEXT|#LVCF_WIDTH|#LVCF_FMT 
colinfo\fmt = #LVCFMT_LEFT 
colinfo\cx = 195 
colinfo\pszText = @"Column Header" 
hwnd = OpenWindow(0,0,0,320,300, "Listview API Demo",#PB_Window_SystemMenu|#PB_Window_ScreenCentered) 
Global lv=CreateWindowEx_(#WS_EX_CLIENTEDGE, "SysListView32", "MyListView",  #LVS_EDITLABELS | #LVS_REPORT | #WS_CHILD | #WS_VISIBLE | #WS_HSCROLL | #WS_VSCROLL , 60,50,200,200,hwnd,0,GetModuleHandle_(0),0) 
SendMessage_(lv, #LVM_INSERTCOLUMN, 0, @colinfo) 
line.LV_ITEM 
line\Mask     = #LVIF_TEXT 
For i=1 To 10
  linetxt.s = "Line "+Str(i)
  line\iitem = i
  line\pszText  = @linetxt
  SendMessage_(lv, #LVM_INSERTITEM, 0, @line) 
Next
Repeat 
  EventID=WaitWindowEvent() 
  Select EventID
    Case #WM_LBUTTONDBLCLK
      lvi.lvhittestinfo
      GetCursorPos_(@lvi\pt)
      GetWindowRect_(lv,@lvpos.rect)
      lvi\pt\x-lvpos\left
      lvi\pt\y-lvpos\top
      SendMessage_(lv, #LVM_HITTEST, 0, @lvi)
      edititem = lvi\iitem
      editcontrol = SendMessage_(lv,#LVM_EDITLABEL,edititem,0)
    Case #WM_KEYUP
      If editcontrol
        If EventwParam()<>#VK_RETURN
          editstring.s=Space(255)
          PokeW(@editstring, 255)
          SendMessage_(editcontrol,#EM_GETLINE,0,@editstring) 
        Else
          editcontrol = 0
          line.LV_ITEM 
          line\Mask     = #LVIF_TEXT 
          line\pszText  = @editstring 
          SendMessage_(lv, #LVM_SETITEMTEXT, edititem, @line) 
        EndIf
      EndIf
  EndSelect
Until EventID=#PB_Event_CloseWindow 
End
BERESHEIT
						

