Page 1 of 1

Api Constant Value

Posted: Mon Aug 07, 2006 10:53 pm
by Konne
Hello where can I get the Values of Constants used by the WindowsaApi.
For Example #WC_LISTVIEW?

Re: Api Constant Value

Posted: Mon Aug 07, 2006 11:03 pm
by Kale
Konne wrote:Hello where can I get the Values of Constants used by the WindowsaApi.
For Example #WC_LISTVIEW?
'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.

http://msdn.microsoft.com/library/defau ... _using.asp

Posted: Tue Aug 08, 2006 1:03 am
by Konne
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?

Posted: Tue Aug 08, 2006 1:11 am
by ts-soft
Examples in the CodeArchiv. Controls with API a created by:

Code: Select all

CreateWindowEx_(
see: http://msdn.microsoft.com/library/defau ... ndowex.asp
Constands for Controls mostly declared in: commctrl.h

Posted: Tue Aug 08, 2006 4:27 am
by netmaestro
Could someone show me an example how to create a Listview in PB via Api?
OK, why not, I'm bored anyway:

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 

End

Posted: Tue Aug 08, 2006 5:09 am
by mskuma
netmaestro, I'm sure many people appreciate how you turn your moments of boredom into great instructional moments for us learners! Thanks! :D

Posted: Tue Aug 08, 2006 11:20 am
by techjunkie
mskuma wrote:netmaestro, I'm sure many people appreciate how you turn your moments of boredom into great intructional moments for us learners! Thanks! :D
Yeah! :lol: :lol: Hope netmaestro is bored a lot! :lol:

Posted: Tue Aug 08, 2006 12:01 pm
by Kale
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?
'Alt-S' in the IDE.

Posted: Tue Aug 08, 2006 12:48 pm
by Konne
Kale wrote:
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?
'Alt-S' in the IDE.
Not all Constants are declared in PB.

And thanks for the great example ;)

Posted: Tue Aug 08, 2006 1:07 pm
by Konne
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

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

End

Posted: Tue Aug 08, 2006 7:59 pm
by netmaestro
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

Posted: Thu Aug 10, 2006 12:58 am
by Konne
Wow thx very much!!!" :D

Posted: Thu Aug 10, 2006 12:50 pm
by Konne
Ok one last question. Where do u get the class name, like: "SysListView32" ?
In msdn they use tell me I have to use WC_TABCONTROL for tabs for example. So where do u get the String?