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 


Wierd TABLE behaviour?

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


Joined: 23 Dec 2004
Posts: 22

PostPosted: Mon Jan 10, 2005 4:49 am    Post subject: Wierd TABLE behaviour? Reply with quote

With reference to the following script:
Code:

  DIALOG CREATE,TableCLICK Test,-1,0,322,160
  DIALOG ADD,TABLE,TABLE1,5,10,301,144,Col1[80]|Col2[80],,CLICK
  DIALOG SHOW
  LIST ADD, TABLE1, Hello@tab()World!
  LIST ADD, TABLE1, Nice to@tab()be here.
 
  :Evloop
  wait event
  goto @event()
 
  :TABLE1CLICK
    Info TABLE1CLICK
#    %t = @item(table1,@index(table1),0)
    goto Evloop

It seems to run as expected and if you click on the first column in the table it generates a TABLE1CLICK event and the Info wondow pops up.

However, if you uncomment the line where the table is referenced and then run it, the behaviour seems not what I would expect. The TABLE1CLICK event is triggered, the Info box pops up so press Ok to clear it. Then click on the first column of the table and click event is triggered but its seems by referencing the table another click event is generated. The end result is that it commences a cycle of click events which can't be broken out of except by killing the program.

I have a program where a row in a table is clicked. I then need to go and perform a task where I have to reference the information in the table that was clicked, but I don't want to generate another click event by doing that. Surely this can be done somehow? I think I must be missing something quite obvious here.

_________________
RipBurn
Back to top
View user's profile Send private message
Boo
Valued Contributor
Valued Contributor


Joined: 31 Oct 2003
Posts: 599
Location: Gulf Breeze, Florida USA

PostPosted: Mon Jan 10, 2005 5:20 am    Post subject: Reply with quote

Hi Ripburn,

How about something like this?

Cheers,

- Boo

Code:

  DIALOG CREATE,TableCLICK Test,-1,0,322,160
  DIALOG ADD,TABLE,TABLE1,5,10,301,144,Col1[80]|Col2[80],,CLICK
  DIALOG SHOW
  LIST ADD, TABLE1, Hello@tab()World!
  LIST ADD, TABLE1, Nice to@tab()be here.
  %%firstrun = 1
  :Evloop
  wait event
  %E = @event()
  if @equal(%%firstrun,1)
  %%firstrun = 0
  if @equal(%E,Table1click)
  %E =
  goto evloop
  end
  end
  goto %E

:TABLE1CLICK
%%select = @dlgtext(table1)
if @not(@null(%%select))
option fieldsep,@tab()
parse "%%item1;%%item2",%%select
option fieldsep,|
Info You clicked on @chr(34)%%item1.@chr(34)
info The item in the next column is @chr(34)%%item2@chr(34)
end
goto Evloop
:Close
exit
Back to top
View user's profile Send private message
ripburn
Newbie


Joined: 23 Dec 2004
Posts: 22

PostPosted: Mon Jan 10, 2005 5:36 am    Post subject: Reply with quote

Thanks Boo... I'm not sure yet as my example was only a cut-down version of my actual program. I have 8 lists, each of which gets loaded into the table depending on which button the user presses. Also, I've enabled full-row select in my table... I'm not sure how that will effect it also. I'll have to look at it in more detail.

Besides all that, is the behaviour I described a bug? It certainly seems wierd to me... and particularly to have to go to these lengths to get it to work as I would have expected it to.

Cheers.

_________________
RipBurn
Back to top
View user's profile Send private message
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Mon Jan 10, 2005 7:39 am    Post subject: Reply with quote

if i understand correctly, the following should help as i have found the same problem

Code:
 DIALOG CREATE,TableCLICK Test,-1,0,322,160
  DIALOG ADD,TABLE,TABLE1,5,10,301,144,Col1[80]|Col2[80],,CLICK
  DIALOG SHOW
  LIST ADD, TABLE1, Hello@tab()World!
  LIST ADD, TABLE1, Nice to@tab()be here.

:Evloop
  wait event
  goto @event()

:TABLE1CLICK
  Info TABLE1CLICK
  %%dummy = @event()
  #    %t = @item(table1,@index(table1),0)
  goto Evloop


if it still happens, add another %%DUMMY = @EVENT() line after the first one - the point of that is to "absorb" dummy event calls that are sometimes generated withour your permission

serge

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
ripburn
Newbie


Joined: 23 Dec 2004
Posts: 22

PostPosted: Mon Jan 10, 2005 8:39 am    Post subject: Reply with quote

Serge... I think that may help, though I need to absorb the dummy event calls in the :TABLE1CLICK code after the table has been accessed by @item(table1) statements (as it is these it seems which trigger the "false" events)... immediately before "goto Evloop". At the moment 2 seem to be needed in my program, though I need to do more testing.

Cheers.

_________________
RipBurn
Back to top
View user's profile Send private message
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Mon Jan 10, 2005 8:50 am    Post subject: Reply with quote

no problem ripburn - add them where you need them and sometimes i have had to had 2 such lines to absorb the "false" tableclick events - i have never needed more than 2

serge

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
jules
Professional Member
Professional Member


Joined: 14 Sep 2001
Posts: 1043
Location: Cumbria, UK

PostPosted: Mon Jan 10, 2005 5:51 pm    Post subject: Reply with quote

The neatest way to do throw away events you don't want is:

Code:
while @event()
wend

_________________
The Tech Pro
www.tech-pro.net
Back to top
View user's profile Send private message Visit poster's website
ripburn
Newbie


Joined: 23 Dec 2004
Posts: 22

PostPosted: Mon Jan 10, 2005 8:10 pm    Post subject: Reply with quote

Thanks Jules... I guess the "trick" is just putting it in the right place.

Any comment as to why the strange table behaviour?

Cheers.

_________________
RipBurn
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
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