Translucency

I want to overlay a part of a (Windows) window with a translucent canvas, to mimick unavailability of controls.
In the Canvas I draw a graphic with translucency set to 50.

The result is ok, but as soon as the mouse moves over the canvas the underlaying controls ‘pop-up’ through the Canvas. How to avoid this? I moved the Z order already, but this has no effect.

Why not simply disabling the controls?

Ye, disable the buttons with hover event handler e.g.?

Hi Massimo,

I was lazy… disabling and enabling all these controls is a lot of work…:stuck_out_tongue:

Put all controls inside a canvas (or whatever RectControl) and then just disable the canvas. All contained controls will be also disabled.

Almost the same amount of work to be done i guess, though.

Massimo’s tip works a treat and we use it all the time, simply send the canvas to the back and then ‘jiggle’ the controls so they accept their new parent, and then when you want to disable them, simply set the enabled state of the parent canvas.

the other way is simply call a method that loop through all the control in the form and then set enabled=false if the property for datasource has a certain words. I making use DataSource property for all sort of these days although it is suppose to be used with Data Binding.


  dim i,j as integer
  dim vctrl as Control
  dim vCtrlName as String
  j=vForm.controlcount - 1
  for i = 0 to j
    vctrl=vForm.Control(i)
    select case vCtrl
    case isa TextField
      vCtrlName=TextField(vctrl).name
      if  TextField(vctrl).DataSource="Disabled" THEN TextField(vctrl).Enabled=False
    case isa TextArea
     vCtrlName= TextArea(vctrl).name
      if  TextArea(vctrl).DataSource="Disabled" THEN TextArea(vctrl).Enabled=False
    end select
  next
  

Great trick!! Never too old to learn…