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 


API question ***Solved***
Goto page Previous  1, 2
 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Advanced Help for VDS 5 & Up
View previous topic :: View next topic  
Author Message
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Mon Mar 26, 2007 8:38 pm    Post subject: Reply with quote

Aslan,
Short of sub-classing the TABLE element I don't know of a way VIA API messages to change an individual's text or background color. You can either change all the text to a specific color of not. The ListView control does not have a message ID for changing individual item colors.

I think CodeScript has a DLL that sub-classes the control to allow you to change individual item colors?

Basicly I was going to release this DSU a long time ago but CodeScript released his so I decided not to bother. I figured he would keep updating his DSU?

As for saving the items go... On exiting your program just walk thourgh each of the items and get their current checkbox states and save those with the table data or in a seperate location that you read back in when your program loads the next time.

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Mon Mar 26, 2007 8:57 pm    Post subject: Reply with quote

Aslan,
I updated my example to persist the checkbox states so now when you close the app it will save the current checkbox states and restore them when you open the application. Also note this is just an example. Usually the user can and would check the box without selecting the item. However attreus wanted to be able to have the box checked when the user selected a row in the table. This seems to make clicking and checking kind of strange in the example. I did not code it such that when the user just clicked the check box that it would move the selection to that row. This could easily be done in the timer loop that is checking the checkbox state.

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
attreus
Valued Newbie


Joined: 30 Jul 2002
Posts: 46
Location: Berlin/Germany

PostPosted: Mon Mar 26, 2007 9:13 pm    Post subject: Reply with quote

@dragonsphere

you are right, it's a strange behaviour. i now use dblclick to check.

i'd like to store checkstates in the table itself. i tried this but it doesn't work:

Code:

:table1Click
  goto evloop
:table1dblClick
  %x = @table(get,checkbox,Table1,@index(Table1))
  if @not(%x)
    table set,CheckBox,TABLE1,@index(Table1),1
    %i = @item(table1)@tab()active
    table update,item,table1,%i
   else
    table set,CheckBox,TABLE1,@index(Table1),0
    %i = @item(table1)
    table update,item,table1,@item(table1)
   end
  %E = @event()
  goto evloop


what is wrong with my update-call?

attreus
Back to top
View user's profile Send private message
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Mon Mar 26, 2007 10:26 pm    Post subject: Reply with quote

attreus,
Here is 1 way you could save the checkbox state with the Table's data. It uses the same example as before just slightly modified so the checkbox's state is saved.

Code:

#-----------------------------------------------------------------------------#
#                                                                             #
# Default script template - to change it edit <vdspath>\default.dsc           #
#                                                                             #
# Author:  Johnny Kinsey                                                      #
#                                                                             #
# Copyright: Copyright 2007 DragonSphere Software                           #
#                                                                             #
#-----------------------------------------------------------------------------#
#INCLUDE utils.dsc

  DIALOG CREATE,New Dialog,-1,0,317,160
REM *** Modified by Dialog Designer on 3/26/2007 - 15:01 ***
  DIALOG ADD,TABLE,TABLE1,10,31,256,108,Column 1[80]|Column 2[80]|Column 3[80]|c[1],,CLICK
  DIALOG ADD,STATUS,STATUS1
  DIALOG SHOW
  # Give the Table grid lines, full row select, info tips, and check boxes
  Table Set,ExtStyle,TABLE1,GRIDLINES|FULLROWSELECT|INFOTIP|CHECKBOXES
  #List Create,1
  #List LoadFile,1,checkstates.dat
  List LoadFile,TABLE1,tbl1.dat
  If @Greater(@count(TABLE1),0)
    %%cnt = 0
    Repeat
      %%State = @Item(TABLE1,%%cnt,3)
      If @Equal(%%State,1)
        Table Set,CheckBox,TABLE1,%%cnt,1
      End
      %%cnt = @succ(%%cnt)
    Until @Equal(%%cnt,@count(TABLE1))
    while @event()
    wend
  Else
    # Add some items to the table
    List Add,TABLE1,row1@tab()This is some real long text to test the infotip@tab()row1@tab()0
    List Add,TABLE1,row2@tab()row2@tab()This is some real long text to test the infotip@tab()0
    List Add,TABLE1,This is some real long text to test the infotip@tab()row3@tab()row3@tab()0
    # Seek to the first item and by the way this will set the checkbox for item 0
    List Seek,TABLE1,0
  End
 
:evloop
  Repeat
    WAIT EVENT,0.5
    %E = @EVENT()
    If %E
      GoSub %E
    End
  Until @Equal(%E,CLOSE)
Exit

:CLOSE
  List SaveFile,TABLE1,tbl1.dat
Exit

:TIMER
  # Get the checkbox state of the last item clicked
  If @Table(Get,CheckBox,TABLE1,%%Index)
    # If checked set the status windows text
    Dialog Set,Status1,%%Index has been checked
  Else
   # if it is not checked clear the status bar
   Dialog Set,Status1,
  End
Exit

:TABLE1CLICK
  # Get the current index of the table
  %%Index = @Index(TABLE1)
  # Togle based on current checkbox state
  If @Table(Get,CheckBox,TABLE1,%%Index)
    #Uncheck if the item is checked
    Table Set,CheckBox,TABLE1,%%Index,0
    %%OldSep = @fsep()
    Option FieldSep,@tab()
    Parse "%%Column1;%%Column2;%%Column3;%%Column4",@Item(TABLE1)
    Option FieldSep,%%OldSep
    List Put,TABLE1,%%Column1@tab()%%Column2@tab()%%Column3@tab()0
  Else
    #Check the item if it is unchecked
    Table Set,CheckBox,TABLE1,%%Index,1
    %%OldSep = @fsep()
    Option FieldSep,@tab()
    Parse "%%Column1;%%Column2;%%Column3;%%Column4",@Item(TABLE1)
    Option FieldSep,%%OldSep
    List Put,TABLE1,%%Column1@tab()%%Column2@tab()%%Column3@tab()1
  End
  while %E
    # This is here to clear the extra click event from changing the Checkbox State
    %E = @event()
  wend
Exit

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
attreus
Valued Newbie


Joined: 30 Jul 2002
Posts: 46
Location: Berlin/Germany

PostPosted: Mon Mar 26, 2007 10:57 pm    Post subject: Reply with quote

hey, this is cool.

is there a way to update the table-record if only the checkbox is clicked?
thats why i thought about LVM_UPDATE instead of using list put.

attreus


Last edited by attreus on Tue Mar 27, 2007 12:57 am; edited 1 time in total
Back to top
View user's profile Send private message
Aslan
Valued Contributor
Valued Contributor


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

PostPosted: Tue Mar 27, 2007 12:52 am    Post subject: Reply with quote

Quote:
Short of sub-classing the TABLE element I don't know of a way VIA API messages


I imagine that this would be the case for any kind of an 'owner drawn' process.
Back to top
View user's profile Send private message Send e-mail
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Tue Mar 27, 2007 1:09 am    Post subject: Reply with quote

Aslan wrote:
Quote:
Short of sub-classing the TABLE element I don't know of a way VIA API messages


I imagine that this would be the case for any kind of an 'owner drawn' process.


Yes this is very true. If the control does not directly support the operation your trying to perform you would have to make it 'owner drawn' by first sub-classing the control and then extending it with new functionality. I believe this is the method that CodeScript took with his VDSGUI.DLL.

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Aslan
Valued Contributor
Valued Contributor


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

PostPosted: Tue Mar 27, 2007 1:42 am    Post subject: Reply with quote

Dragonspere,

Please see new post on your site under WinAPI.
Back to top
View user's profile Send private message Send e-mail
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Tue Mar 27, 2007 3:21 am    Post subject: Reply with quote

Aslan wrote:
Dragonspere,

Please see new post on your site under WinAPI.


BTW if you don't mind please just send a PM if you need someone to look at a different website. Especially when it comes to my forum since my forum is only for registered users of my software it would not be fair to others on this message board. Wink

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Advanced Help for VDS 5 & Up All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
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