Il martedì 25 agosto 2009 11:43:05 Aleksandrs Livshics ha scritto: > On Tuesday 25 August 2009 12:25:08 Fabien Bodard wrote: > > you don't understand the stop event function.. > > > > stop event stop the event propagation...(so the widjet stop to act) > > but not the current sub execution ! > > > > if you want to stop the sub too you need to add a 'return' keyword ! > > > > > > > > if ok then > > stop event > > return > > endif > > > > nevertheless send me a short sample exemple and i will see what i can do > > > > 2009/8/25 Aleksandrs Livshics <alek...@mpe.lv>: > > > On Monday 24 August 2009 17:33:39 Fabien Bodard wrote: > > >> 2009/8/24 Aleksandrs Livshics <alek...@mpe.lv>: > > >> > Dear Gambas users, > > >> > I am new to Gambas and my question may be silly, > > >> > however I cannot find how to set a slider value in the > > >> > code. (Not the initial value, this is easy) > > >> > I want to specify some event (like double click on a slider) > > >> > to force it to jump to a predefined position/value. > > >> > > > >> > If I write Dbl_click() method and use something like > > >> > My_slider.value = The_value > > >> > in it, then slider on screen does not move from where > > >> > I have set it previously with a mouse. More precisely, > > >> > It jumps to a position which corresponds to The_value > > >> > and back to where it was before! > > >> > Any ideas would be helpful. > > >> > > >> try to stop the event after setting the value > > >> > > >> public sub MySlider_DblClick() > > >> My_slider.value = The_value > > >> Stop Event > > >> end > > > > > > Thank you for a quick reply. Unfortunately > > > when I have added the "STOP EVENT " line > > > nothing really has been changed. When I assign > > > some value to the slider and PRINT it after the "STOP EVENT" > > > I have the wanted value printed 2 TIMES and then probably the > > > "change" event happens. In my "Change" > > > I print the value again as you see below. It is printed also 2 > > > times and in both cases the old value is restored. > > > > > > > > > PUBLIC SUB SMySlider_Change() > > > PRINT " Change -> ", MySlider.value > > > END > > > > > > The slider on the screen shows the same: > > > first it jumps to a specified position and the back... > > > Alex > > > > > > > > > ----------------------------------------------------------------------- > > >-- ----- Let Crystal Reports handle the reporting - Free Crystal Reports > > > 2008 30-Day trial. Simplify your report design, integration and > > > deployment - and focus on what you do best, core application coding. > > > Discover what's new with Crystal Reports now. > > > http://p.sf.net/sfu/bobj-july > > > _______________________________________________ > > > Gambas-user mailing list > > > Gambas-user@lists.sourceforge.net > > > https://lists.sourceforge.net/lists/listinfo/gambas-user > > > > ------------------------------------------------------------------------- > >-- --- Let Crystal Reports handle the reporting - Free Crystal Reports > > 2008 30-Day trial. Simplify your report design, integration and > > deployment - and focus on what you do best, core application coding. > > Discover what's new with Crystal Reports now. > > http://p.sf.net/sfu/bobj-july > > _______________________________________________ > > Gambas-user mailing list > > Gambas-user@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/gambas-user > > OK, here is an example... > The form has just one slider, nothing else. > I want it to jump to ZERO if double clicked, no matter > where it was before. > If it is not at the ZERO position when double clicked > it in fact jumps to ZERO and immediately back !...
Found a solution: ' Gambas class file PRIVATE $boolWantZeroValue AS Boolean PUBLIC SUB _new() END PUBLIC SUB Form_Open() END PUBLIC SUB Slider1_Change() PRINT "change: ", Slider1.Value IF $boolWantZeroValue THEN Slider1.Value = 0 $boolWantZeroValue = FALSE ENDIF END PUBLIC SUB Slider1_DblClick() $boolWAntZeroValue = TRUE Slider1.Value = 0 PRINT "dbl: ", Slider1.Value END ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user