If Application.DarkTheme Then
Print "Hi Anakin"
Else
Print "Hi Obi-Wan"
Endif
If Component.IsLoaded("gb.gtk3") Then
Print "Benoit dice que el toolkit es:" & "gb.gtk3"
Endif
Print "Bruce dice que el toolkit es:" & Env["GB_GUI"]
' Gambas class file
Public Sub Form_Open()
Dim GridView1 As GridView
Dim sData As New String[]
Dim MyComponent As Component
Dim sLib As String
Dim iCol, iRow As Integer
Dim sHeader As String[] = ["Component.Name", "Component.Version", "Component.Library"]
For Each MyComponent In Components
If MyComponent.Library = True Then sLib = "True" Else sLib = "False"
sData.Add(MyComponent.Name & "," & MyComponent.Version & "," & sLib)
Next
With Me
.Height = 400
.Width = 450
.Padding = 5
.Arrangement = Arrange.Vertical
.Center
End With
With GridView1 = New GridView(Me) As "Gridview1"
.Clear
.Rows.Count = sData.Count
.Columns.Count = 3
.Expand = True
.Header = Gridview.both
End With
For iCol = 0 To 2
Gridview1.Columns[iCol].Title = sHeader[iCol]
Next
For iRow = 0 To sData.Max
For iCol = 0 To 2
Gridview1[iRow, iCol].Text = Split(sData[iRow])[iCol]
Next
Next
GridView1.Columns.Width = -1
End
(24-09-2022, 17:54)cogier escribió: Espero que este código haga lo que quieres.
' Gambas class file
Public Sub Form_Open()
Dim GridView1 As GridView
Dim sData As New String[]
Dim MyComponent As Component
Dim sLib As String
Dim iCol, iRow As Integer
Dim sHeader As String[] = ["Component.Name", "Component.Version", "Component.Library"]
Dim pnl As Panel
Dim btn As Button
For Each MyComponent In Components
If MyComponent.Library = True Then sLib = "True" Else sLib = "False"
sData.Add(MyComponent.Name & "," & MyComponent.Version & "," & sLib)
Next
With pnl = New Panel(Me) As "Panel1"
.h = 42
.w = 120
.Arrangement = Arrange.Horizontal
.Margin = True
End With
With btn = New Button(pnl) As "Button11"
.h = 42
.w = 60
If gtkToolkit() Then
.Text = "GTK"
Else
.Text = "QT"
Endif
End With
With Me
.Height = 400
.Width = 450
.Padding = 5
.Arrangement = Arrange.Vertical
.Center
End With
With GridView1 = New GridView(Me) As "Gridview1"
.Clear
.Rows.Count = sData.Count
.Columns.Count = 3
.Expand = True
.Header = Gridview.both
End With
For iCol = 0 To 2
Gridview1.Columns[iCol].Title = sHeader[iCol]
Next
For iRow = 0 To sData.Max
For iCol = 0 To 2
Gridview1[iRow, iCol].Text = Split(sData[iRow])[iCol]
Next
Next
GridView1.Columns.Width = -1
End
Public Function gtkToolkit() As Boolean
Dim MyComponent As Component
Dim bgtk As Boolean
For Each MyComponent In Components
If MyComponent.Name = "gb.gtk3" Then
bgtk = True
Break
Endif
Next
Return bgtk
End