[Gelöst] Calc: Problem mit Listbox im Dialog

Antwort erstellen


BBCode ist eingeschaltet
[img] ist ausgeschaltet
[url] ist eingeschaltet
Smileys sind ausgeschaltet

Die letzten Beiträge des Themas
   

Ansicht erweitern Die letzten Beiträge des Themas: [Gelöst] Calc: Problem mit Listbox im Dialog

Re: Calc: Problem mit Listbox im Dialog

von retuwe61 » Fr, 14.07.2017 20:08

Vielen Dank.
Gruß
Uwe

Re: Calc: Problem mit Listbox im Dialog

von gschuckar » Do, 13.07.2017 20:09

Moin Uwe,
ändere in "Sub Dialog_Anzeigen" die Zeile

Code: Alles auswählen

	oLB1_Listener = createUnoListener("list_1", "com.sun.star.awt.XActionListener")
in

Code: Alles auswählen

	oLB1_Listener = createUnoListener("list1_", "com.sun.star.awt.XActionListener")
Mit freundlichem Gruß
Gerd

[Gelöst] Calc: Problem mit Listbox im Dialog

von retuwe61 » Do, 13.07.2017 16:01

Hallo miteinander.
Mit Hilfe von Toxitoms Buch habe ich einen Dialog mit 2 Listboxen erstellt. Der in "Liste1" ausgewählte Wert soll in Tabelle1.R1 und derjenige aus "Liste2" in Tabelle1.S1 eingetragen werden. Das Erste klappt, das Zweite nicht. Kann bitte jemand einen Blick darauf werfen?
Danke.
Gruß
Uwe

Code: Alles auswählen

global odlg as object
global oWinListener 
global oAktListener
global oLB_Listener
global oLB1_Listener
dim oEvent
dim oNix

Sub Dialog_Anzeigen
	oDlgMod = createUnoService("com.sun.star.awt.UnoControlDialogModel")
	with oDlgMod
		.setPropertyValue("Height", 90)
		.setPropertyValue("Width", 224)
		.setPropertyValue("Title", "Einstellungen und Auswahl")
	end with
	
	oDlg = createUnoService("com.sun.star.awt.UnoControlDialog")
	oWinListener = createUnoListener("bas2_", "com.sun.star.awt.XTopWindowListener")
	oDlg.addTopWindowListener(oWinListener)
	oDlg.setModel(oDlgMod)
	oAktListener = createUnoListener("end_", "com.sun.star.awt.XActionListener")
	oLB_Listener = createUnoListener("list_", "com.sun.star.awt.XActionListener")
	oLB1_Listener = createUnoListener("list_1", "com.sun.star.awt.XActionListener")
		
	octl1 = oDlgMod.createInstance("com.sun.star.awt.UnoControlFixedTextModel")
	with oCtl1
		.setPropertyValue("Label", "Filter Schlüsselzahl")
		.setPropertyValue("PositionX", 74)
		.setPropertyValue("PositionY", 1)
		.setPropertyValue("Height", 14)
		.setPropertyValue("Width", 139)
	end with
	oDlgMod.insertByName("Text1", oCtl1)
	
dim aListe()
	aListe = array(" ", "0", "1", "2", "3", "4", "5", "6", "7")
	octl2 = oDlgMod.createInstance("com.sun.star.awt.UnoControlListBoxModel")
	with oCtl2
		.setPropertyValue("StringItemList", aListe)
		.setPropertyValue("PositionX", 55)
		.setPropertyValue("PositionY", 11)
		.setPropertyValue("Height", 12)
		.setPropertyValue("Width", 20)
		.Dropdown = true
	end with
	oDlgMod.insertByName("Liste1", oCtl2)
	oControl = oDlg.getControl("Liste1")
	oControl.addActionListener(oLB_Listener)
	
dim aListe1()
	aListe1 = array(" ", "A", "B", "C", "D", "E", "F", "G", "H")
	octl3 = oDlgMod.createInstance("com.sun.star.awt.UnoControlListBoxModel")
	with oCtl3
		.setPropertyValue("StringItemList", aListe1)
		.setPropertyValue("PositionX", 76)
		.setPropertyValue("PositionY", 11)
		.setPropertyValue("Height", 12)
		.setPropertyValue("Width", 20)
		.Dropdown = true
	end with
	oDlgMod.insertByName("Liste2", oCtl3)
	oControl = oDlg.getControl("Liste2")
	oControl.addActionListener(oLB1_Listener)	
	
	oCtl3 = oDlgMod.createInstance("com.sun.star.awt.UnoControlButtonModel")
	with oCtl3
		.setPropertyValue("Label", "Zurück")
		.setPropertyValue("PositionX", 1)
		.setPropertyValue("PositionY", 1)
		.setPropertyValue("Height", 12)
		.setPropertyValue("Width", 51)
		.setPropertyValue("MultiLine", True)
	end with
	oDlgMod.insertByName("But1", oCtl3)	
	oControl1 = oDlg.getControl("But1")
	oControl1.addActionListener(oAktListener)	
	odlg.setvisible(true)
End Sub

REM Aktionen des Top-Window Event Listeners
sub bas2_windowClosing()
	odlg.removeTopWindowListener(oWinListener)
	odlg.setVisible(false)
end sub

sub bas2_windowActivated
	'nix
end sub

sub bas2_windowDeActivated
	'nix
end sub

REM Aktion Button Schliessen gedrückt
sub end_actionPerformed(oEvent)
	odlg.removeTopWindowListener(oWinListener)
	odlg.setVisible(false)
end sub

REM Aktion Listeneintrag Klick
sub list_actionPerformed(oNix)
	Trage_Ein(onix.ActionCommand)
end sub

sub list1_actionPerformed(oNix)
	Trage_Ein1(onix.ActionCommand)
end sub

sub Trage_ein(sText as String)
    oDoc = thisComponent
    oSheet = oDoc.Sheets.getByName ("Tabelle1")
	oZelle = oSheet.getCellRangeByName ("R1")
		oZelle.string = sText
end sub

sub Trage_ein1(sText as String)
    oDoc = thisComponent
    oSheet = oDoc.Sheets.getByName ("Tabelle1")
	oZelle = oSheet.getCellRangeByName ("S1")
		oZelle.string = sText
end sub

Nach oben