forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


TABLE element problem
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
Aslan
Valued Contributor
Valued Contributor


Joined: 31 May 2001
Posts: 589
Location: Memphis, TN USA

PostPosted: Sat Nov 19, 2005 7:50 pm    Post subject: Add Table SubItem Images Reply with quote

I haven't figured out how to change the StateImages yet but, with a lot of
help from ShinobiSoft (Thanks) We managed to get images to show up in other columns.

Note: This uses the SStree.dll to create the ImageList and the images that came with the demo. So you can run this script from the SStree Demo folder.

Code:
  external @path(%0)SStreevw.dll
  #define COMMAND,TREEVIEW
  #define FUNCTION,TREEVIEW
  #Include BitWise.dsc
rem BITWISE.DSC code was derived from http://forum.vdsworld.com/viewtopic.php?t=1860

# Create the TreeView's ImageList and add some images to it.
  %%imgList = @treeview(imgList_Create,16,16,color32|MASK,0,1)
  %%oldBk  = @treeview(imgList_SetBkColor,%%imgList,255|255|255)
  %%img0 = @treeview(imgList_AddMasked,%%imgList,Misc14.bmp,255|255|255,16,16)
  %%img1 = @treeview(imgList_AddMasked,%%imgList,Misc14a.bmp,255|255|255,16,16)
  %%img2 = @treeview(imgList_AddMasked,%%imgList,Misc15.bmp,255|255|255,16,16)
  %%img3 = @treeview(imgList_AddMasked,%%imgList,Misc15a.bmp,255|255|255,16,16)
 
# Create the TreeView's StateImageList and add some images to it.
  %%StateimgList = @treeview(imgList_Create,16,16,color32|MASK,0,1)
  %%oldBk  = @treeview(imgList_SetBkColor,%%StateimgList,255|255|255)
  %%img0 = @treeview(imgList_AddMasked,%%StateimgList,AddIni.bmp,255|255|255,16,16)
  %%img1 = @treeview(imgList_AddMasked,%%StateimgList,Fldr.bmp,255|255|255,16,16)

  DIALOG CREATE,Table Image Demo,-1,0,357,261
  DIALOG ADD,TABLE,TABLE1,20,17,323,155,Column 0[80]|Column 1[80]|Column 2[80]|Column 3[80],,DBLCLICK,COLUMNSORT
  DIALOG ADD,BUTTON,Close,225,276,64,24,Close
  DIALOG ADD,TEXT,TEXT1,185,18,,,Select Column:
  DIALOG ADD,EDIT,EDIT1,180,99,16,19,0
  DIALOG ADD,TEXT,TEXT2,207,23,,,Select Image:
  DIALOG ADD,EDIT,EDIT2,203,98,17,19,0
  DIALOG ADD,SPIN,Style,228,65,50,22,,,,CLICK
  DIALOG ADD,TEXT,StyleTx,235,26,,,Style:
  DIALOG ADD,CHECK,STATE,182,172,54,18,STATE
  DIALOG ADD,TEXT,StateTx,208,136,,,State Image:
  DIALOG ADD,EDIT,EDIT3,203,205,16,19,0
  DIALOG SHOW
 
  # LVM_SETIMAGELIST As LVSIL_SMALL
  %x = @SENDMSG(@WINEXISTS(~TABLE1),@SUM($1000,3),1,%%imgList)
  # LVM_SETIMAGELIST As LVSIL_STATE
  %x = @SENDMSG(@WINEXISTS(~TABLE1),@SUM($1000,3),2,%%StateimgList)
  # LVS_EX_SUBITEMIMAGES
  %x = @SENDMSG(@WINEXISTS(~TABLE1),@SUM($1000,54),0,$2)
 
  # Add some items to the table
  LIST ADD,TABLE1,0/0@tab()0/1@tab()0/2@tab()0/3
  LIST ADD,TABLE1,0/1@tab()1/1@tab()1/2@tab()1/3
  LIST ADD,TABLE1,0/2@tab()2/1@tab()2/2@tab()2/3
  LIST ADD,TABLE1,0/3@tab()3/1@tab()3/2@tab()3/3
 
:EVLOOP
  wait event
  goto @event()
 
:StyleCLICK
  # Style  (Note: Some Styles cancel LVS_EX_SUBITEMIMAGES)
  %x = @SENDMSG(@WINEXISTS(~TABLE1),@SUM($1000,54),0,@dlgtext(Style))
  goto evloop
 
 
:Table1DBLCLICK

If @equal(@dlgtext(State),1)
 #LVITEM Structure for LVM_SETITEMSTATE
   #MASK
  %%MASK = $8
  #iItem
  %%iItem = @index(Table1)
  #ISubItem = 0
    %%iIndex = @dlgtext(edit3)
  %%state = @SSBitLShift(%%iIndex,12)
  %%stateMask = $F000
  # Create LVITEM
  %%LVITEM = @binary(DWORD,%%MASK)@binary(DWORD,%%iItem)@binary(DWORD,0)@binary(DWORD,%%state)@binary(DWORD,%%stateMask)
 
  %%LVM_SETITEMSTATE = @SENDMSG(@WINEXISTS(~TABLE1),@SUM($1000,43),%%iItem,%%LVITEM)
Else
 #LVITEM Structure for LVM_SETITEMA
  #MASK
  %%LVIF_IMAGE = $2
  #iItem
  %%iItem = @index(Table1)
  #ISubItem
  %%iSubItem = @dlgtext(edit1)
  #state = 0
  #stateMask = 0
  #pszText = 0
  #cchTextMax = 0
  %%iImage = @dlgtext(edit2)
  # Create LVITEM
  %%LVITEM = @binary(DWORD,%%LVIF_IMAGE)@binary(DWORD,%%iItem)@binary(DWORD,%%iSubItem)@binary(DWORD,0)@binary(DWORD,0)@binary(DWORD,0)@binary(DWORD,0)@binary(DWORD,%%iImage)@binary(DWORD,0)
  # Apply the image to the table
  %%LVM_SETITEMA = @SENDMSG(@WINEXISTS(~TABLE1),@SUM($1000,6),0,%%LVITEM)
End
 goto evloop
 
:CloseBUTTON
:Close
  exit


Last edited by Aslan on Mon Nov 21, 2005 5:43 pm; edited 4 times in total
Back to top
View user's profile Send private message Send e-mail
Aslan
Valued Contributor
Valued Contributor


Joined: 31 May 2001
Posts: 589
Location: Memphis, TN USA

PostPosted: Sun Nov 20, 2005 8:35 am    Post subject: Re: Add Table SubItem Images (Demo) Reply with quote

Ok I got the StateImages to work now.

Thanks again to Shinobisoft for pointing me to Snarling Sheep's BitWise
code http://forum.vdsworld.com/viewtopic.php?t=1860

Note: With State images you can use other than 16x16 images

See below to download a demo...


Aslan



TableImagesDemo.zip
 Description:

Download
 Filename:  TableImagesDemo.zip
 Filesize:  34.15 KB
 Downloaded:  1090 Time(s)

Back to top
View user's profile Send private message Send e-mail
Aslan
Valued Contributor
Valued Contributor


Joined: 31 May 2001
Posts: 589
Location: Memphis, TN USA

PostPosted: Mon Nov 21, 2005 5:36 pm    Post subject: Table SubItem Images Demo (DLL FREE) Reply with quote

You can use VDS's internal ImageList that holds the regular Table element images.
In the code below I created a 0 sized Table just to assign images. Get the ImageList Handle to the Table and then assign it to the Table that is displayed.

Note: Your bitmap size needs to be 16x16 or smaller. You also can't use custom size State Images with this method.

Code:
  #INCLUDE BITWISE.DSC
REM BITWISE.DSC code was derived from http://forum.vdsworld.com/viewtopic.php?t=1860
 
  TITLE Table Image Demo [DLL FREE]
  DIALOG CREATE,Table Image Demo [DLL FREE],-1,0,357,261
  DIALOG ADD,TABLE,TABLE1,20,17,323,155,Column 0[80]|Column 1[80]|Column 2[80]|Column 3[80],,DBLCLICK,COLUMNSORT
  DIALOG ADD,TABLE,TABLEIMG,0,0,0,0
  DIALOG ADD,BUTTON,Close,225,276,64,24,Close
  DIALOG ADD,TEXT,TEXT1,185,18,,,Select Column:
  DIALOG ADD,EDIT,EDIT1,180,99,16,19,0
  DIALOG ADD,TEXT,TEXT2,207,23,,,Select Image:
  DIALOG ADD,EDIT,EDIT2,203,98,17,19,0
  DIALOG ADD,SPIN,Style,228,65,50,22,,,,CLICK
  DIALOG ADD,TEXT,StyleTx,235,26,,,Style:
  DIALOG ADD,CHECK,STATE,182,172,54,18,STATE
  DIALOG ADD,TEXT,StateTx,208,136,,,State Image:
 
  # Add images
  List add,TABLEIMG,|Misc14.bmp
  List add,TABLEIMG,|Misc14a.bmp
  List add,TABLEIMG,|Misc15.bmp
  List add,TABLEIMG,|Misc15a.bmp
  List add,TABLEIMG,|Fldr.bmp
 
  # Get Handle to TABLEIMG ImageList
  #LVM_GETIMAGELIST As LVSIL_SMALL
  %%TABLEIMG = @SENDMSG(@WINEXISTS(~TABLEIMG),@SUM($1000,2),1,0)
  # Assign TABLEIMG ImageList to TABLE1
  # LVM_SETIMAGELIST As LVSIL_SMALL
  %x = @SENDMSG(@WINEXISTS(~TABLE1),@SUM($1000,3),1,%%TABLEIMG)
  # LVM_SETIMAGELIST As LVSIL_STATE
  %x = @SENDMSG(@WINEXISTS(~TABLE1),@SUM($1000,3),2,%%TABLEIMG)
  # LVS_EX_SUBITEMIMAGES
  %x = @SENDMSG(@WINEXISTS(~TABLE1),@SUM($1000,54),0,$2)
 
  DIALOG SHOW
 
  # Add some items to the table
  LIST ADD,TABLE1,0/0@tab()0/1@tab()0/2@tab()0/3
  LIST ADD,TABLE1,0/1@tab()1/1@tab()1/2@tab()1/3
  LIST ADD,TABLE1,0/2@tab()2/1@tab()2/2@tab()2/3
  LIST ADD,TABLE1,0/3@tab()3/1@tab()3/2@tab()3/3
 
:EVLOOP
  wait event
  goto @event()
 
:StyleCLICK
  # Style  (Note: Some Styles cancel LVS_EX_SUBITEMIMAGES and any style that inculudes checkboxes,
  # will assign a SystemImageList as the StateImageList thereby disabling User StateImageLists
  %x = @SENDMSG(@WINEXISTS(~TABLE1),@SUM($1000,54),0,@dlgtext(Style))
  goto evloop
 
 
:Table1DBLCLICK

If @equal(@dlgtext(State),1)
 #LVITEM Structure for LVM_SETITEMSTATE
   #MASK
  %%MASK = $8
  #iItem
  %%iItem = @index(Table1)
  #ISubItem = 0
    %%iIndex = @dlgtext(edit3)
  %%state = @SSBitLShift(%%iIndex,12)
  %%stateMask = $F000
  # Create LVITEM
  %%LVITEM = @binary(DWORD,%%MASK)@binary(DWORD,%%iItem)@binary(DWORD,0)@binary(DWORD,%%state)@binary(DWORD,%%stateMask)
 
  %%LVM_SETITEMSTATE = @SENDMSG(@WINEXISTS(~TABLE1),@SUM($1000,43),%%iItem,%%LVITEM)
Else
 #LVITEM Structure for LVM_SETITEMA
  #MASK
  %%LVIF_IMAGE = $2
  #iItem
  %%iItem = @index(Table1)
  #ISubItem
  %%iSubItem = @dlgtext(edit1)
  #state = 0
  #stateMask = 0
  #pszText = 0
  #cchTextMax = 0
  %%iImage = @dlgtext(edit2)
  # Create LVITEM
  %%LVITEM = @binary(DWORD,%%LVIF_IMAGE)@binary(DWORD,%%iItem)@binary(DWORD,%%iSubItem)@binary(DWORD,0)@binary(DWORD,0)@binary(DWORD,0)@binary(DWORD,0)@binary(DWORD,%%iImage)@binary(DWORD,0)
  # Apply the image to the table
  %%LVM_SETITEMA = @SENDMSG(@WINEXISTS(~TABLE1),@SUM($1000,6),0,%%LVITEM)
End
 goto evloop
 
:CloseBUTTON
:Close
  exit


Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Goto page Previous  1, 2, 3
Page 3 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group