PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio â†’ WINDEV 2024 â†’ How to assosciate a scroll bar to the static control
How to assosciate a scroll bar to the static control
Iniciado por guest, 03,jun. 2015 09:02 - 16 respuestas
Publicado el 03,junio 2015 - 09:02
Hi,

I am using a static control in my application to show logs. I want to assoscialte a sroll bar so that it will automatically scroll down if data becomes large.

Is there any UI item in WinDev better than static control and scroll bar to implement logger window.

Thanks and Regards,
Naveen Rathan
Publicado el 03,junio 2015 - 09:42
Hi, just use a multiline Edit control instead of a static control! You can prevent input by defining it as 'read only'.
Publicado el 03,junio 2015 - 11:18
Hi,

Thanks for the input. It worked; but automatic scroll is not as expected. Now scroll bar is visible but the log is not the latest; I mean user has to scroll down to see the latest log. I have selected 'automatic' in the description; still the behaviour is same.

Thanks and Regards,
Naveen Rathan
Publicado el 03,junio 2015 - 12:00
Naveen,

It's not the scroll bar that you need to set. I think you're looking for ..cursor to place the cursor at the end of the text in your multiline control.

Try; http://help.windev.com/en-US/…
Publicado el 03,junio 2015 - 15:32
Hi,

No, cursor property is not solving the issue.
My problem scenario: I have implemented a logger using edit control. Now I have appended 100 lines to the control. Scroll bar is visible as expected but the display is at first page. Ideally it should show the 100th line. Any help is appreciatd.


Thanks and Regards,
Naveen Rathan
Publicado el 03,junio 2015 - 15:35
By the way I am using below snippet to append data

Win_Win1.EDT_logger += [RC]+"sample message"

Any help is appreciated!

Thanks and Regards,
Naveen Rathan
Publicado el 03,junio 2015 - 15:43
for this why not one table control instead?

It's simpler to fill, manage the scroll bars, sort, position and you can take advantage of the AAF like export to excel and so on.
Publicado el 03,junio 2015 - 15:46
Hallo,

do you mean :

Win_Win1.EDT_logger = [RC]+"sample message" + Win_Win1.EDT_logger

Christoph
Publicado el 03,junio 2015 - 16:19
Hi, just add the log-entries in different sequence!

If the log-Edit-Control is named LOGEDIT and the new Text comes in then

LOGEDIT = NewText + LOGEDIT

That's it ..
Publicado el 04,junio 2015 - 07:21
Hello all,

With "LOGEDIT = [RC] + NewText + LOGEDIT" I am able to print my logs line by line, how ever if I add more logs scroll bar doesnt work automatically. As I keep on adding logs scroll bar should scroll automatically to show the user latest logs. In my case it is not happening. I have to scroll manually to see the latest logs.

PS: Automatic scroll is checked in the cedit control properties.

Thanks and Regards,
Naveen Rathan
Publicado el 04,junio 2015 - 08:29
Hi

If you use a table instead as Paulo suggested you get everything you discribe and a lot more. You can print line by line as well. even export to excel etc

Just create a tabe with a colum for the logedit. Create a table with the colums you want. make it by programming.

Then: sometyhing like this

logedit is string
logedit = xxxxxxx

Tableaddline ( tablenamen, Logedit )

This way you add the lines to the table. You can sort the table print it export it to excel etc


regards
Allard
Publicado el 04,junio 2015 - 11:59
Hi all,

Most of you guys didnot understand my problem. M yproblem is with the scroll bar. As you keep on adding logs/text the scroll bar should keep on moving and show the latest logs; which is not happening. I have to manually drag the scroll bar to see the latest logs. This problem is seen even if automatic scroll is selected.

@Allard, Same behaviour even with table. Any help for this?

Thanks and Regards,
Naveen Rathan
Publicado el 04,junio 2015 - 12:10
Naveen,

when using a tablecontrol you can use TablePosition() to make sure the last lines are shown "as visible"

For the static control maybe something like this will work
SendMessage(Handle(STC_Static1),WM_VSCROLL,1000,0)
Publicado el 04,junio 2015 - 13:12
Hi,

As someone said before, using the cursor property could work.

This piece of code seems to work in the click event of a button (Edit1 is a multiline edit control)

FOR i=1 TO 1000
Edit1 += "line" + i + CR
Edit1..Cursor = Length(Edit1)+1
END

regards,
Bart
Publicado el 04,junio 2015 - 14:04
Yes...
Publicado el 04,junio 2015 - 14:13
Hi Bart,

It works on click of a button. But my code is in the initilization part of a window. In this scenario it doesnt behave as expected. Strange!!

Anyn help here?

Thanks and Regards,
Naveen Rathan
Publicado el 04,junio 2015 - 14:37
HI Naveen

without seeing your code ?

good luck with that