Página 1 de 1
How can access dynamically TOptionItems adden in a TOptionList
Publicado: Mar Abr 04, 2006 5:02 pm
por Dionisis Divaris
HI Ignacio , Jose and all Xailer's
How can we access the onClick event on a dynamically created ( not created
with the ToptionItems designer ) ToptionItem inside a TOptionList that
is included in a TExplorerGroup ???
TIA
Dionisis
How can access dynamically TOptionItems adden in a TOptionList
Publicado: Mié Abr 05, 2006 11:05 am
por joseluis
Dionisis,
Here you are a piece of code that creates an optionlist and assign an
action to onclick event:
WITH OBJECT ::oOpcionesEspeciales := TOptionList():New(
GlobalGes:oForm:oEB_Mantenimiento )
:SetBounds( 11, 36, 245, 88 )
:lAutoSize := .T.
// Generates ImageList
IF LEN( aImageList ) > 0
WITH OBJECT :oImageList
:nWidth := 16
:nHeight := 16
FOR EACH cImage IN aImageList
:Add( cImage )
NEXT
END
ENDIF
FOR EACH aOpcion IN ::aOpcionesEspeciales //
::aOpcionesEspeciales is an array containing info about items to be created
WITH OBJECT :AddItem( aOpcion[1] )
:OnClick := "PorHacer" // this is a method
declared in the form
IF LEN(aOpcion) > 1
nPos := ASCAN(aImageList, aOpcion[2])
:nImage := nPos
ENDIF
END
NEXT
:Create()
END
To launch onclick event 'manually' you should call
::oOpcionesEspeciales:aItems[n]:Click( )
Hope it helps you.
Regards,
José Luis Capel
Dionisis Divaris escribió:
> HI Ignacio , Jose and all Xailer's
>
> How can we access the onClick event on a dynamically created ( not created
> with the ToptionItems designer ) ToptionItem inside a TOptionList that
> is included in a TExplorerGroup ???
>
> TIA
> Dionisis
>
>
How can access dynamically TOptionItems adden in a TOptionList
Publicado: Mié Abr 05, 2006 11:05 am
por joseluis
Dionisis,
Here you are a piece of code that creates an optionlist and assign an
action to onclick event:
WITH OBJECT ::oOpcionesEspeciales := TOptionList():New(
GlobalGes:oForm:oEB_Mantenimiento )
:SetBounds( 11, 36, 245, 88 )
:lAutoSize := .T.
// Generates ImageList
IF LEN( aImageList ) > 0
WITH OBJECT :oImageList
:nWidth := 16
:nHeight := 16
FOR EACH cImage IN aImageList
:Add( cImage )
NEXT
END
ENDIF
FOR EACH aOpcion IN ::aOpcionesEspeciales //
::aOpcionesEspeciales is an array containing info about items to be created
WITH OBJECT :AddItem( aOpcion[1] )
:OnClick := "PorHacer" // this is a method
declared in the form
IF LEN(aOpcion) > 1
nPos := ASCAN(aImageList, aOpcion[2])
:nImage := nPos
ENDIF
END
NEXT
:Create()
END
To launch onclick event 'manually' you should call
::oOpcionesEspeciales:aItems[n]:Click( )
Hope it helps you.
Regards,
José Luis Capel
Dionisis Divaris escribió:
> HI Ignacio , Jose and all Xailer's
>
> How can we access the onClick event on a dynamically created ( not created
> with the ToptionItems designer ) ToptionItem inside a TOptionList that
> is included in a TExplorerGroup ???
>
> TIA
> Dionisis
>
>
How can access dynamically TOptionItems adden in a TOptionList
Publicado: Mié Abr 05, 2006 11:53 am
por jfgimenez
Dionisis,
> How can we access the onClick event on a dynamically created ( not created
> with the ToptionItems designer ) ToptionItem inside a TOptionList that
> is included in a TExplorerGroup ???
You can assign this event directly, just how Jose Luis has pointed:
::oOptionList1:aItems[1]:OnClick := "MethodToBeExecuted"
or
::oOptionList1:aItems[1]:OnClick := {| oSender | DoWhatEverYouWant() }
--
Regards,
Jose F. Gimenez
How can access dynamically TOptionItems adden in a TOptionList
Publicado: Mié Abr 05, 2006 11:53 am
por jfgimenez
Dionisis,
> How can we access the onClick event on a dynamically created ( not created
> with the ToptionItems designer ) ToptionItem inside a TOptionList that
> is included in a TExplorerGroup ???
You can assign this event directly, just how Jose Luis has pointed:
::oOptionList1:aItems[1]:OnClick := "MethodToBeExecuted"
or
::oOptionList1:aItems[1]:OnClick := {| oSender | DoWhatEverYouWant() }
--
Regards,
Jose F. Gimenez