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 


Search and Show using Table

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
Rubes_sw
Valued Contributor
Valued Contributor


Joined: 11 Jun 2001
Posts: 625
Location: Northern Ireland

PostPosted: Mon Aug 28, 2006 9:45 am    Post subject: Search and Show using Table Reply with quote

I've been trying to figure this out for ages:

Search a Table and scroll to the found item !

Anyone any code snipets ?

Nathan
Back to top
View user's profile Send private message Send e-mail Visit poster's website
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Mon Aug 28, 2006 4:18 pm    Post subject: Reply with quote

I don't believe you can do this with just VDS, as the message that is sent to search a listview(table), needs a pointer to a structure which is filled with the info to search for. Sounds like alot just to find an item, but you could be searching through just the first column, or one of the many sub-columns you could have, so it needs some extra info.
_________________
-Sheep
My pockets hurt...
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 Aug 28, 2006 5:25 pm    Post subject: Reply with quote

Here's a snippet from one of my apps where I the user clicks a Search button.



Code:
  %%find = @input(Search:)
  If @ok()
  list seek,table1,0
  %%found = @match(table1,%%find)
  %x = @sendmsg(~table1,$1013,@index(table1),0)
  If @null(%%found)
    Info %%find not found.
  end
  end
Back to top
View user's profile Send private message Send e-mail
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Mon Aug 28, 2006 5:35 pm    Post subject: Reply with quote

Ah, apparently @match() works for tables.. figures.
The line:"%x = @sendmsg(~table1,$1013,@index(table1),0)" isn't doing anything though.
That would be the message you would send, if you filled the structure and put its address in place of the 0 at the end, to find items instead of using @match().

Here's a full example:
Code:

DIALOG CREATE,Table Search,-1,0,524,318
  DIALOG ADD,TABLE,TABLE1,52,26,458,245,Column 1[80]|Column 2[80]|Column 3[80]
  DIALOG ADD,EDIT,EDIT1,24,140,180,19
  DIALOG ADD,BUTTON,Find,21,327,64,24,Find,,,default
  DIALOG SHOW
  LIST ADD, table1, Blah
  LIST ADD, table1, Test
:Evloop
  wait event
  goto @event()
:FindBUTTON
  dialog focus, table1
  %%find = @dlgtext(edit1)
  If @ok()
  list seek,table1,0
  %%found = @match(table1,%%find)
  If @null(%%found)
    Info %%find not found.
  end
  goto evloop
:Close
  exit

_________________
-Sheep
My pockets hurt...
Back to top
View user's profile Send private message Send e-mail
Rubes_sw
Valued Contributor
Valued Contributor


Joined: 11 Jun 2001
Posts: 625
Location: Northern Ireland

PostPosted: Mon Aug 28, 2006 6:00 pm    Post subject: Reply with quote

Combining both of your code:

Code:
%%find = @dlgtext(edit1)
dialog focus, table1 
  If @ok()
  list seek,table1,0
  %%found = @match(table1,%%find)
  %x = @sendmsg(~table1,$1013,@index(table1),0)
  If @null(%%found)
    Info No records matching %%find have been found.
  end
  goto evloop


This works great !

Thanks guys

Nathan

This code, will search all the columns within the table and then scroll to the record/row if it finds it. Smile
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Aslan
Valued Contributor
Valued Contributor


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

PostPosted: Mon Aug 28, 2006 6:58 pm    Post subject: Reply with quote

Snarling Sheep,

Your example needs more items for LVM_ENSUREVISIBLE to work.

%x = @sendmsg(~table1,$1013,@index(table1),0)

=

%x = @sendmsg(~table1,@SUM($1000,19),@index(table1),0)


LVM_ENSUREVISIBLE As Int: = @SUM($1000,19)

%x = @sendmsg(~table1,$1019,@index(table1),0) does NOT work

but

%x = @sendmsg(~table1,$1013,@index(table1),0) DOES work


Funny thing I think I may have found this in one of your posts SS Smile
Back to top
View user's profile Send private message Send e-mail
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Mon Aug 28, 2006 8:00 pm    Post subject: Reply with quote

Hmm.. My code used $01019.
That's odd.. Whatever works I guess Smile

_________________
-Sheep
My pockets hurt...
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
Page 1 of 1

 
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