1. Property of scroll bar

I have set up several scroll bars on the screen via a sequence.  By using
the onScroll event, I execute a procedure that is comon to all scroll bar
objects.  Is there a property of the selected scroll bar that I can check
to see if that scroll bar is the one that caused the onScroll event.

This question may make more sense if you see the code so far.  Each Scroll
bar should have it's position displayed below it (in numeric format).

Here is the code:

 include win32lib.ew
include Ports.e

--***Define Global Variables***
global sequence Scrollers,ScrollValues

Scrollers={}
ScrollValues={}

--***This is the main window***
constant MainWindow=create(Window,"Remote Parallel Port
Control",0,10,10,600,500,0)

--***Create the 15 control slides and Scroll Value Positions***
for x=1 to 15 do
 Scrollers=append(Scrollers,create
(VScroll,"",MainWindow,x*30+30,30,10,100,0))
 setScrollRange(Scrollers[x],1,255)
 setScrollPos(Scrollers[x],255)
 ScrollValues=append(ScrollValues,create
(16,"",MainWindow,x*30+30,140,30,20,0))
end for

--***Create Procedure executed for Scroll Event
procedure onScroll_Scrollers(integer ScrollPosition)
integer ActiveScroll
 for x=1 to 15 do
  if isEnabled(Scrollers[x]) then
   ActiveScroll=x
  end if
 end for
end procedure

--***Create Events to be captured
for x=1 to 15 do
 onScroll[Scrollers[x]] = routine_id("onScroll_Scrollers")
end for

WinMain(MainWindow,Normal)

new topic     » topic index » view message » categorize

2. Re: Property of scroll bar

Hi,

I do something similar to what you are trying to do like so:

for i=scroll[1] to scroll[15] do
  -- where scroll is the sequence containing all the VScoll or HScroll you
  -- made on the fly
  onScroll[i]=routine_id.....
end for

Judith Evans

new topic     » goto parent     » topic index » view message » categorize

3. Re: Property of scroll bar

So, once the procedure is executed because of the onScroll event
how do you determine which Scroll Bar caused the event that
triggered the procedure?  I am assuming that the procedure
is common for any Scroll Bar event.

new topic     » goto parent     » topic index » view message » categorize

4. Re: Property of scroll bar

Once you are in the onScroll event routine_id you can do this:

squence WhichScroll

WhichScroll=getSelf()
if WhichScroll=Scroll[1] then....
       --where Scroll is your sequence of the HScroll and VScroll you made
       --on the fly
elsif WhichScroll=Scroll[2] then

.
.
.
end if

One thing of caution, though. I recall that some controls that I have made
on the fly will not respond to events as they would if made when defining
the window. I hope that is clear; I have a hard time describing things......
 For example making a control, that normally responds onclick, on the fly
'might' not respond to onClick and you would have to do an onMouse routine
instead.

Judith Evans

new topic     » goto parent     » topic index » view message » categorize

5. Re: Property of scroll bar

On Thu, 13 Jan 2000 14:45:03 -0500, Judith Evans <camping at FLASH.NET> wrote:

>Once you are in the onScroll event routine_id you can do this:
>
>squence WhichScroll
>
>WhichScroll=getSelf()
>if WhichScroll=Scroll[1] then....
>       --where Scroll is your sequence of the HScroll and VScroll you made
>       --on the fly
>elsif WhichScroll=Scroll[2] then
>
>.
>.
>.
>end if
>
>One thing of caution, though. I recall that some controls that I have made
>on the fly will not respond to events as they would if made when defining
>the window. I hope that is clear; I have a hard time describing
things......
> For example making a control, that normally responds onclick, on the fly
>'might' not respond to onClick and you would have to do an onMouse routine
>instead.
>
>Judith Evans

Thank you VERY much!  That is exactly what I was looking for...

Thanks...                 Andy.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu