Page 1 sur 1

[Résolu][Calc]Statut case à cocher toujours non coché

Publié : 16 avr. 2018 14:35
par mickat
Bonjour,

Je teste une macro pour lier deux case à cocher.
Pour commencer j'ai fait ce test : Je clique sur une case à cocher et j'indique par une message box le statut de la case à cocher...
Hors, le statut est toujours à 0 ( non coché )....
Quelqu'un peut-il m'indiquer pourquoi cette bizarrerie existe ??? !!
Merci pour votre aide !!

Voici le code :

Code : Tout sélectionner

REM  *****  BASIC  *****

Sub Main
	DialogLibraries.LoadLibrary("Standard")
    oDialog1 = CreateUnoDialog( DialogLibraries.Standard.Dialog1 )
    
    oDialog1.execute	

End Sub

Sub case1
	DialogLibraries.LoadLibrary("Standard")
    oDialog1 = CreateUnoDialog( DialogLibraries.Standard.Dialog1 )
    case_1 = oDialog1.getControl("case1")
    Select Case case_1.state
    	Case 0 
    		MsgBox case_1.State
    	Case 0 
    		MsgBox case_1.State
    End Select
    			
End Sub
Sub case2
	DialogLibraries.LoadLibrary("Standard")
    oDialog1 = CreateUnoDialog( DialogLibraries.Standard.Dialog1 )
    case_2 = oDialog1.getControl("case2")
    Select Case case_2.state
    	Case 0 
    		MsgBox case_2.State
    	Case 0 
    		MsgBox case_2.State
    End Select
    			
End Sub

Re: [Calc]Statut des case à cocher indique toujours non coch

Publié : 16 avr. 2018 16:19
par Piaf
Bonjour
Pas forcement tout compris à ta macro.
Tu peux tester

Code : Tout sélectionner

Dim oDlg as Object
Sub Main
   DialogLibraries.LoadLibrary("Standard")
    oDlg = CreateUnoDialog( DialogLibraries.Standard.Dialog1 )
    oDlg.execute   
End Sub

Sub Statecase(oEv as Object)
	Select Case oEv.Source.Model.Name
		Case "Case1"
			MsgBox("Etat Case1 : " & oEv.Source.Model.State & Chr(13) & "Etat Case2 : " & oDlg.getControl("Case2").Model.State)
		Case "Case2"
			MsgBox("Etat Case1 : " & oDlg.getControl("Case1").Model.State & Chr(13) & "Etat Case2 : " & oEv.Source.Model.State)
	End Select	
End Sub
A+

Re: [Calc]Statut des case à cocher indique toujours non coch

Publié : 18 avr. 2018 05:46
par mickat
Merci
je vais voir ça avec ton code, je vous tiens au courant

Re: [Calc]Statut des case à cocher indique toujours non coch

Publié : 19 avr. 2018 18:02
par mickat
Merci à tous,
le code fonctionne !!