Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

List Views


3 replies to this topic

mallen

mallen
  • Members
  • 6 posts

Posted 16 May 2003 - 14:14

Hi

I'm creating a dialog which has 3 edit boxes on it, an 'Add' button and a ListView control. What I want to do is type in values in the 3 edit boxes, press the 'Add' button and the values from the edit boxes then appear as one line in the ListView control.

How on earth do I do this??

Please help

Michelle

sad.gif

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 16 May 2003 - 15:38

You create a custom action that dynamically adds rows to the ListBox table.
In addition, you make a copy of the dialog, and with each button click to switch between the dialog twins. That's required to refrsh the list box.

mallen

mallen
  • Members
  • 6 posts

Posted 16 May 2003 - 15:46

Stefan

I know how to add custom actions but what will the custom action do exactly. Will it call installscript code or what?
Also how do you do the second part of your solution.

More details please for me,

Many Thanks

Michelle

Stefan Secker

Stefan Secker
  • Members
  • 46 posts

Posted 16 May 2003 - 16:50

Hi mallen

here's a kind of code snippet i played around with some time ago. I didn't manage to get it run corrctly, but i didn't knew that i have to have a dialog twin to update the controls....

Anyway it's a VB Script CA code... you have to write your list values into the specific MSI table, and i suppose afterwards switch to the dialog twin... the step that i missed obviously when i tried that stuff.

The code might not be correct in each line, but i guess it will give you an idea of what you need to do. cool.gif

Cheers
Stefan

CODE

Public Function AppendListBox ()
Dim oDatabase
Dim oView
Dim oInstaller

Dim oRecord
Dim intCount
Dim oRecordErr

On Error Resume Next

Set oDatabase = Session.Database

Set oView = oDatabase.OpenView("SELECT * FROM ListBox")

If oView Is Nothing Then
Set oDatabase = Nothing
Exit Function
End If

  Set oInstaller = Session.Installer

'Each record will have four columns. First is the property, second an id
'third to the value and the fourth to the key
Set oRecord = oInstaller.CreateRecord(4)

If Not oRecord Is Nothing Then
'Set the property of the control to which the records are to be attached
oRecord.StringData(1) = "MYPROPERTY"
oRecord.IntegerData(2) = id '(integer)
oRecord.StringData(3) = "value"
oRecord.StringData(4) = "key"
End If

On Error Resume Next
'Read/Write on to the view
oView.Modify 7,oRecord

Set oRecord = Nothing

Set oRecordErr = oInstaller.LastErrorRecord

If Not oRecordErr Is Nothing Then
For intCount = 0 to oRecordErr.FieldCount
ShowError oRecordErr.StringData & " " & oRecordErr.IntegerData
Set oRecordErr = Nothing
Exit Function
Next
End If

oView.Close
Set oView = Nothing
Set oDatabase = Nothing
Set oInstaller = Nothing
Set oRecord = Nothing
Set oRecordErr = Nothing

End Function