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 positioning
Goto page Previous  1, 2
 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
marcelo
Contributor
Contributor


Joined: 10 May 2008
Posts: 155

PostPosted: Wed Jan 26, 2011 8:51 pm    Post subject: Reply with quote

Thanks SnarlingSheep!!!
I tryed your suggest but it doesn't works too...
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: Thu Jan 27, 2011 10:28 pm    Post subject: Reply with quote

Sorry, I've been out of town the last few days but I think I found your solution.

Ok it looks like SEEK and @MATCH change the selection but don't change the FOCUS. So when you use the arrow keys, they start at the last focused item.

So when we change the selection with SEEK or @MATCH, we need to change the focus with them.
I added the API to do this.

Note: You can consolidate the LVM_ENSUREVISIBLE and the LVM_SETITEMSTATE APIs into a single VDS command as I did with "SetItemFocus" in the code below.

Code:
 TITLE "Play List"
 
#DEFINE COMMAND,SetItemFocus

 DIALOG CREATE,Play List,-1,0,512,308
  DIALOG ADD,STYLE,StyleFB,,,,004080,WHITE
  DIALOG ADD,BUTTON,Search,257,202,56,24,Search,,DEFAULT
  DIALOG ADD,TABLE,TABLE1,13,11,490,234,Track[250]|Length,,StyleFB,DBLCLICK
  DIALOG ADD,EDIT,SearchEdit,260,12,180,19,<Enter Search>,,CLICK
  DIALOG ADD,BUTTON,Random,257,363,64,24,Random
  DIALOG ADD,BUTTON,Sequential,257,437,64,24,Sequential
  DIALOG ADD,STATUS,STATUS1,
  DIALOG ADD,BUTTON,Stop,257,277,64,24,Stop
 DIALOG SHOW
  Dialog disable,Search
 
REM Build sample Play List in TABLE1
 %n = 0
 Repeat
  %n = @succ(%n)
  list add,TABLE1,Track-%n@tab()@random(1,7):@random(0,9)@random(0,9)
 Until @equal(%n,20)
 list seek,TABLE1,0
 
:evloop
REM Check every 0.05 sec to see if the TABLE1 index has changed
#   The extra param after "wait event" will cause the TIMER event
  wait event,0.05
  goto @event()

:Timer
REM Show current index in the status bar
  Dialog set,status1,@item(TABLE1)
  goto evloop
 
:RandomBUTTON
 %%seq = 0
 %%rand = 1
 %E = @event()
:ResumeRandom
 Repeat
  list seek,TABLE1,@random(0,20)
  SetItemFocus TABLE1
  Dialog set,status1,@item(TABLE1)
  wait 2
  %E = @event()
  If @both(%E,@unequal(%E,TIMER))
   until 1
   goto %E
  end
 Until %E
 goto %E
 
:SequentialBUTTON
 %%seq = 1
 %%rand = 0
 %E = @event()
 %E =
  %s = 1
  list seek,TABLE1,0
  SetItemFocus TABLE1
  Dialog set,status1,@item(TABLE1)
  wait 2
:ResumeSequence
  Repeat
   list seek,TABLE1,%s
   SetItemFocus TABLE1
   Dialog set,status1,@item(TABLE1)
   %s = @succ(%s)
   wait 2
   %E = @event()
   If @both(%E,@unequal(%E,TIMER))
    until 1
    goto %E
   end
  Until @equal(@count(TABLE1),%s)
  goto evloop
 
:TABLE1DBLCLICK
  Dialog set,status1,@item(TABLE1)
  %s = @index(TABLE1)
  If @equal(%%seq,1)
   Dialog set,status1,@item(TABLE1)@tab()Resuming Sequence in 2 sec
   wait 2
   goto ResumeSequence
  end
  If @equal(%%rand,1)
   Dialog set,status1,@item(TABLE1)@tab()Resuming Random in 2 sec
   wait 2
   goto ResumeRandom
  end
  goto evloop
 
:SearchBUTTON
  %i = @index(TABLE1)
  List seek,TABLE1,0
  If @match(TABLE1,@dlgtext(SearchEdit))
   SetItemFocus TABLE1
   Dialog set,status1,@item(TABLE1)
  else
   List seek,TABLE1,%i
   SetItemFocus TABLE1
   Dialog set,status1,@item(TABLE1)
  end
  goto evloop

:SearchEditCLICK
  dialog enable,Search
  dialog set,SearchEdit,
  goto evloop
 
:StopBUTTON
  %%seq = 0
  %%rand = 0
  goto evloop
   
:Close
  exit
 
:SetItemFocus
# SetItemFocus <table>
REM The following will ensure that the current index of the table is visible
#   LVM_ENSUREVISIBLE = $1013
  %x = @sendmsg(~%1,$1013,@index(%1),0)
REM Use LVITEM structure to set state to 1 and statemask to LVIS_FOCUSED
  %L = @binary(DWORD,$8)@binary(DWORD,@index(%1))@binary(DWORD,0)@binary(DWORD,1)@binary(DWORD,$1)
#  Call LVM_SETITEMSTATE to move the focus rectangle to the current selection
  %x = @sendmsg(~%1,@sum($1000,43),@index(%1),%L)
  exit


Last edited by Aslan on Fri Jan 28, 2011 2:52 pm; edited 2 times in total
Back to top
View user's profile Send private message Send e-mail
marcelo
Contributor
Contributor


Joined: 10 May 2008
Posts: 155

PostPosted: Fri Jan 28, 2011 1:21 pm    Post subject: Reply with quote

YEEEEEEEEEEEEEEEEEEES!!!!!!!!!!!!!!!!!!!!!!!
This is exactly what i need!!!
You did it!!!
Thanks a lot!!!
Back to top
View user's profile Send private message
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
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