[Gambas-user] Progressbar_mousedown() does not work [solved]

Fabien Bodard gambas.fr at ...626...
Mon Nov 17 23:14:05 CET 2014


well this is another temporary soluce for this problem Tobias :


Private Function FindControl(hParent as Container, sControlName as
String) as Object

dim hControl as Object

For each hControl in hParent.Children

if hControl is Container then
  hControl = FindControl(hControl, sControlName)
  if hControl then return hControl
Else
  if Object.Class(hControl).Name = sControlName then return hControl
endif
next

End


OBS = New Observer(FindControl(ProgressBar1, "DrawingArea")) as "OBS"


2014-11-17 13:53 GMT+01:00 Tobias Boege <taboege at ...626...>:
> On Mon, 17 Nov 2014, Fabien Bodard wrote:
>> Progressbar is just a drawingarea that dsplay a blue square ....so
>> putting a drawingarea  on another is not really the soluce
>>
>> You can do :
>>
>>
>> ' Gambas class file
>>
>> Private OBS As Observer
>>
>>
>> Public Sub Form_Open()
>>
>>   OBS = New Observer(ProgressBar1.Children[0]) As "OBS"
>>
>> End
>>
>>
>> Public Sub OBS_MouseDown()
>>
>>   ProgressBar1.Value = Mouse.x / ProgressBar1.W
>>
>> End
>>
>
> ... but note that this solution depends on the ordering of children in the
> ProgressBar control, which you have no control over or guarantees about.
>
> Fabien is perfectly right with his answer but if I decide tomorrow to put
> another thing into the ProgressBar, the above code may not work any longer.
>
> Regards,
> Tobi
>
> --
> "There's an old saying: Don't change anything... ever!" -- Mr. Monk
>
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
> http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user



-- 
Fabien Bodard




More information about the User mailing list