[clean-list] How can I select/unselect a custom control ?

Peter Achten P.Achten at cs.ru.nl
Thu May 19 13:51:51 MEST 2011


Dear Maurizio,

The selectstate of a control tells whether the control accepts (Able) or does not accept (Unable) keyboard/mouse input. In your example, its initial selectstate is Able. To change the selectstate, use 
the functions enableControl and disableControl. For instance, add the following control to your dialog:

          { newLS  = True
          , newDef = ButtonControl "Enable/Disable" [ControlFunction (toggle id1)]
          }

and include its callback function:

   toggle id1 (able,pst)
     = (not able,appPIO (if able disableControl enableControl id1) pst)

This creates a button control with a local boolean state (initially True), that, when clicked, toggles the current selectstate of the custom control.

Object I/O has no support for telling a control whether or not the mouse is entering or leaving a control. I am not sure if that is what you're after.

Regards,
Peter

On 5/17/2011 11:14 AM, Ferreira Maurizio wrote:
> How can I select/unselect a custom control ?
>
> It seems to me there are no functions to set/unset the select state of a custom control,
> neither it changes state as you click on it or on another control in the same dialog.
> In the following example I would like to change from selected state (Red) to Unselected (Green).
>
> Any suggestion ?
>
> Regards
> Maurizio
>
> module hello
>
> import StdEnv, StdIO
>
> Start world
>    #(ids,world) = openIds 2 world
>    = startIO NDI "ps" (snd o openDialog 1 (hello ids) ) [ProcessClose closeProcess] world
>
> where
>
>    hello [id1,id2] = Dialog "Hello dialog"
>            (CustomControl {w=50,h=30} showcustom [ ControlPos (Left, zero)
>                                                  , ControlId id1
>                                                  , ControlSelectState Able
>                                                  , ControlFunction myfun
>                                                  ]
>            :+:
>            EditControl "" (PixelWidth 100) 1 [ControlPos (Left, zero), ControlId id2]
>            )
>            [ WindowClose  (noLS closeProcess)
>            , WindowViewSize {w=150, h=80}
>            , WindowPos (Fix, OffsetVector {vx=400, vy=350})
>            ]
>
>    myfun st = st
>
>    showcustom Able {newFrame} picture
>      # picture = setPenColour Red picture
>      = fill newFrame picture
>
>    showcustom Unable {newFrame} picture
>      # picture = setPenColour Green picture
>      = fill newFrame picture
>
>
>
>
>
> -----------------------------------------------------------------------------
>
> Il presente messaggio, corredato dei relativi allegati, contiene informazioni da considerarsi strettamente riservate ed è destinato esclusivamente al destinatario sopra indicato, il quale è l'unico autorizzato ad usarlo, copiarlo e, sotto la propria responsabilità, diffonderlo. Chiunque ricevesse questo messaggio per errore o comunque lo leggesse senza esserne legittimato è avvertito che trattenerlo, copiarlo, divulgarlo, distribuirlo a persone diverse dal destinatario è severamente proibito, ed è pregato di rinviarlo immediatamente al mittente distruggendone l'originale.
>
>
> This message, together with its annex(es), contains information to be deemed strictly confidential and is destined only to the addressee(s) identified above who only may use, copy and, under his/their responsibility, further disseminate it. If anyone received this message by mistake or reads it without entitlement is forewarned that keeping, copying, disseminating or distributing this message to persons other than the addressee(s) is strictly forbidden and is asked to transmit it immediately to the sender and to erase the original message received.
>
>
>
> _______________________________________________
> clean-list mailing list
> clean-list at science.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/clean-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/clean-list/attachments/20110519/b720dc38/attachment.html>


More information about the clean-list mailing list