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 


Scroll to bottom
Goto page 1, 2  Next
 
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
bBrD
Newbie


Joined: 15 Nov 2006
Posts: 9
Location: Raleigh, NC

PostPosted: Wed Nov 15, 2006 11:16 pm    Post subject: Scroll to bottom Reply with quote

I am using an edit field to show dialog between two machines. Itís a chat program. I have everything working the way I like is so far, except for the scroll. I do not like that every time a new message comes in the scroll bar goes up to the top. Is there a way that I can make it stay on the bottom?

For a temporary fix, I have reversed the input. Meaning when a new message comes in its posted at the top. It works, but itís not exactly what I had in mind.

Anyways, I will appreciate any thoughts or advice.
Thanks for your time.
Very Happy bBrD Very Happy
Back to top
View user's profile Send private message
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Thu Nov 16, 2006 2:16 am    Post subject: Reply with quote

i think that you can do it using API calls ... if you are new to this, you will need to download the API help file http://www.vdsworld.com/download.php?id=331&sid=b9195f91f21c200c0eb0f10362b74bdf

and then look for EM_GETLINECOUNT to get the numbers of line in your edit box, and use EM_LINESCROLL to scroll down that number of lines

hope this is what you are after

serge

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


Joined: 15 Nov 2006
Posts: 9
Location: Raleigh, NC

PostPosted: Thu Nov 16, 2006 2:54 am    Post subject: Reply with quote

I actually already tried that. Lol. But I could have done something wrong, so I will try it again. Ill let you know if I it works this time.

Thanks for the help.
Very Happy bBrD Very Happy
Back to top
View user's profile Send private message
bBrD
Newbie


Joined: 15 Nov 2006
Posts: 9
Location: Raleigh, NC

PostPosted: Thu Nov 16, 2006 2:59 am    Post subject: Reply with quote

Yeah, I DID do something wrong. I believe this is going to work perfectly. Thank you so much.

Very Happy bBrD Very Happy
Back to top
View user's profile Send private message
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Thu Nov 16, 2006 3:25 am    Post subject: Reply with quote

you are welcome Very Happy

serge

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


Joined: 15 Nov 2006
Posts: 9
Location: Raleigh, NC

PostPosted: Thu Nov 16, 2006 7:51 pm    Post subject: Reply with quote

I am having a little problem here. I am using API calls to count the lines and then if they are more then 13, I scroll down one page at a time until the line count is 0. However, I'm getting an error on the repeat, and I have no idea why. I have rearranged the order and renamed the variables, but that didn't do anything. Another bit of information, its erroring out at line 9 (meaning, I get 9 lines counted and then it breaks, and I am adding the lines one at a time.)

I am giving you a copy of my code and a picture with the error and line that is giving the error.

Code:
  %O = @sendmsg(@winExists(~log),$0BA,0,0)
  repeat
  %%command = @sendmsg(@winExists(~log),$0B5,3,0)
  if @GREATER(%O,13)
    until @equal(%O,0)
    wait 0.5
  end
goto evloop



Any help is greatly appreciated, if you need more details, just ask.

Thank you for your time.



vdserrorwithcode.bmp
 Description:
 Filesize:  371.06 KB
 Viewed:  25658 Time(s)

vdserrorwithcode.bmp



_________________
Very Happy bBrD Very Happy /\/\
_________\./\/|
_________\./|/|
_|__('>|_|_|/|/|///
_|/( C) |_|_|/|/////
_|///|//|_|_|///////
//////////////////////

Follower of Teacher, Mentor, Lord of the Code Webdaddy
Back to top
View user's profile Send private message
ShinobiSoft
Professional Member
Professional Member


Joined: 06 Nov 2002
Posts: 790
Location: Knoxville, Tn

PostPosted: Thu Nov 16, 2006 9:11 pm    Post subject: Reply with quote

I still don't quite grasp what your code is attempting to do here, but I have
spotted an error:

Code:

%O = @sendmsg(@winExists(~log),$0BA,0,0)
  repeat
  %%command = @sendmsg(@winExists(~log),$0B5,3,0)
  if @GREATER(%O,13)
    until @equal(%O,0)
    wait 0.5
  end
goto evloop


should be something like:
Code:

  %O = @sendmsg(@winExists(~log),$0BA,0,0)
  repeat
    %%command = @sendmsg(@winExists(~log),$0B5,3,0)
    if @GREATER(%O,13)
      wait 0.5
    end
  until @equal(%O,0)
  goto evloop


Here is a code snippett that will scroll an edit control:
Code:

      REM WM_SETFOCUS
      %z = @sendmsg(~ed1,7,0,0)
      REM EM_GETFIRSTVISIBLELINE
      %%topLine = @sendmsg(~ed1,206,0,0)
      REM We need the character index of the line in question
      REM EM_LINEFROMCHAR
      %%curLine = @sendmsg(~ed1,201,-1,0)
      REM Determine how many lines we need to scroll
      if @greater(%%topLine,%%curLine)
        %%scroll = -@diff(%%topLine,%%curLine)
      else
        %%scroll = @diff(%%curLine,%%topLine)
      end
      REM EM_LINESCROLL
      REM Scroll the edit control
      %z = @sendmsg(~ed1,182,0,%%scroll)
      REM Now move the caret to the top line
      REM EM_GETFIRSTVISIBLELINE
      %%topLine = @sendmsg(~ed1,206,0,0)
      REM EM_LINEINDEX
      %%curLine = @sendmsg(~ed1,187,%%topLine,0)
      REM EM_SETSEL
      %z = @sendmsg(~ed1,177,%%curLine,%%curLine)


Hopefully this will help solve your problem. Any questions, please feel free
to ask.

_________________
Bill Weckel
ShinobiSoft Software

"The way is known to all, but not all know it."
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
vdsalchemist
Admin Team


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

PostPosted: Thu Nov 16, 2006 9:20 pm    Post subject: Reply with quote

bBrD,
The reason is because the UNTIL command is not being executed since it is inside the If @Greater(%O,13). VDS has a limit on the number of times you can call REPEAT before you call a coresponding UNTIL. You really should not place a UNTIL inside of a IF construct like that. Your logic here is the issue...

Your telling VDS that you want to start a REPEAT UNTIL loop but since %O is not greater than 13 VDS does not execute the UNTIL instead it drops down to the goto evloop and I guess when it goes to the evloop it is redirected to the REPEAT command again but after so many REPEAT commands being executed it errors out because it never reaches a UNTIL.

I think the code below is closer to what you want? The code below stops the loop if %O = 0 or %O > 13

Code:

  %O = @sendmsg(@winExists(~log),$0BA,0,0)
  repeat
    %%command = @sendmsg(@winExists(~log),$0B5,3,0)
    wait 0.5
  until @equal(%O,0) @GREATER(%O,13)
goto evloop

_________________
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
bBrD
Newbie


Joined: 15 Nov 2006
Posts: 9
Location: Raleigh, NC

PostPosted: Thu Nov 16, 2006 10:43 pm    Post subject: Reply with quote

Thank you both for your suggestions, I tried every one, sadly they didnít give me what I was looking for. Maybe I am not explaining properly, so I will try again.
I would like my edit field to scroll down as lines are added to it. The best example I can give is a chat window. When you send a message itís posed in the conversation area, the message moves up and the scrollbar moves down, so that the most recent message is always visible.
So far all I have been getting is the first 13 lines, everything after the 13th line is not visible and I have to scroll manually to get it. Which is ok, unless I am still getting messages. Since every time a new message comes in it jumps back to the first line.
I am going to keep working with what you have already given me, just in case I missed something. Very Happy

I really appreciate all your ideas, thank you for taking the time to help me.

_________________
Very Happy bBrD Very Happy /\/\
_________\./\/|
_________\./|/|
_|__('>|_|_|/|/|///
_|/( C) |_|_|/|/////
_|///|//|_|_|///////
//////////////////////

Follower of Teacher, Mentor, Lord of the Code Webdaddy
Back to top
View user's profile Send private message
bBrD
Newbie


Joined: 15 Nov 2006
Posts: 9
Location: Raleigh, NC

PostPosted: Thu Nov 16, 2006 11:08 pm    Post subject: Reply with quote

I GOT IT!!!! I GOT IT!!!! Very Happy Very Happy Very Happy

Here is what I ended up doing...

Code:
  %%line = @sendmsg(@winExists(~log),$0BA,0,0)
  if @GREATER(%%line,13)
   goto scroll
  end
  goto evloop
 
:scroll
  repeat
  %%scroll = @sendmsg(@winExists(~log),$0B5,3,0)
  until @equal(%%line,0)@GREATER(%%line,13)
  goto evloop


Thank you all so much for helping me. I am so happy to have found VDSWorld.

_________________
Very Happy bBrD Very Happy /\/\
_________\./\/|
_________\./|/|
_|__('>|_|_|/|/|///
_|/( C) |_|_|/|/////
_|///|//|_|_|///////
//////////////////////

Follower of Teacher, Mentor, Lord of the Code Webdaddy
Back to top
View user's profile Send private message
vdsalchemist
Admin Team


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

PostPosted: Fri Nov 17, 2006 12:39 am    Post subject: Reply with quote

bBrD,
IMHO it would be better to do this...

Code:

  %%line = @sendmsg(@winExists(~log),$0BA,0,0)
  if @GREATER(%%line,13)
   gosub scroll
  end
  goto evloop
 
:scroll
  repeat
  %%scroll = @sendmsg(@winExists(~log),$0B5,3,0)
  until @equal(%%line,0)@GREATER(%%line,13)
Exit


This would keep the structure of your code and not break out and leave a dangling IF.

_________________
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
bBrD
Newbie


Joined: 15 Nov 2006
Posts: 9
Location: Raleigh, NC

PostPosted: Fri Nov 17, 2006 1:07 am    Post subject: Reply with quote

dragonsphere,

Yes you are correct, I have made that change to my code. Thank you for pointing that out to me. Smile

_________________
Very Happy bBrD Very Happy /\/\
_________\./\/|
_________\./|/|
_|__('>|_|_|/|/|///
_|/( C) |_|_|/|/////
_|///|//|_|_|///////
//////////////////////

Follower of Teacher, Mentor, Lord of the Code Webdaddy
Back to top
View user's profile Send private message
bBrD
Newbie


Joined: 15 Nov 2006
Posts: 9
Location: Raleigh, NC

PostPosted: Tue Dec 12, 2006 12:03 am    Post subject: Finally I got it working.... Reply with quote

I wanted to share with you all my final solution to my scrolling problem. I havenít had the time to work on it, in a while, but tonight it all came to me, and it works perfect.

First off, thank you Serge for suggesting API calls. I have spent a good bit of time playing with them, and now I think I understand them.

My problem was for an edit box that gets random text sent to it and I needed to be able to see the last line sent, without selecting it or manually scrolling to it.

My solution:
Code:
%i = @sendmsg(@WINEXISTS(~log),$0BA,0,0)
 if @greater(%i,13)
 %z = @sendmsg(@WINEXISTS(~log),$0B6,0,%i)
 end


I hope this will be useful to somone else.

_________________
Very Happy bBrD Very Happy /\/\
_________\./\/|
_________\./|/|
_|__('>|_|_|/|/|///
_|/( C) |_|_|/|/////
_|///|//|_|_|///////
//////////////////////

Follower of Teacher, Mentor, Lord of the Code Webdaddy
Back to top
View user's profile Send private message
DaveR
Valued Contributor
Valued Contributor


Joined: 03 Sep 2005
Posts: 412
Location: Australia

PostPosted: Tue Dec 26, 2006 8:17 am    Post subject: Re: Finally I got it working.... Reply with quote

bBrD wrote:
My solution:
Code:
%i = @sendmsg(@WINEXISTS(~log),$0BA,0,0)
 if @greater(%i,13)
 %z = @sendmsg(@WINEXISTS(~log),$0B6,0,%i)
 end


I hope this will be useful to somone else.

Thanks bBrD. (and DragonSphere, and ShinobiSoft for his commented code snippet)

This was exactly the API call I needed to add a finishing touch to one of my programs. Cool

_________________
cheers

Dave
Back to top
View user's profile Send private message Visit poster's website
jwfv
Valued Contributor
Valued Contributor


Joined: 19 Mar 2002
Posts: 422
Location: Beaufort, SC

PostPosted: Tue Dec 26, 2006 4:51 pm    Post subject: Reply with quote

Yes, this might be helpful to me as well. Thanks, all.

bBrD - welcome to VDSWorld. I see you are in Raleigh. I do a lot of VDS programming for software we use in our main office in Chapel Hill, right down the road. Nice to know there are other VDS users in the area. The more users, the better for the language.

Joe

_________________
Joe Floyd
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 -> Advanced Help for VDS 5 & Up All times are GMT
Goto page 1, 2  Next
Page 1 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