Lahey Support
04-27-2004, 11:30 PM
Visual Studio: ListBox and ComboBox items display as System.Object
Lahey issue number: FSW-4717
<hr>
The information in this post applies to:
LF Fortran v7.x Enterprise edition
LF Fortran v7.x Academic edition
LF Fortran v7.0 Developer edition
LF Fortran v7.0 Educational edition
Symptoms
When the collection is populated for the items property of a ListBox or ComboBox control, code is generated like this example:
class(System%Object),dimension(:),pointer :: ASPTMP1
...
allocate( ASPTMP1( 3 ) )
ASPTMP1( 1 ) => USTRING("blue")
ASPTMP1( 2 ) => USTRING("green")
ASPTMP1( 3 ) => USTRING("red")
When the form is displayed, all of the items show as "System.Object".
Cause
Bug in the Visual Studio Fortran integration code generator.
Workaround
When your Windows Forms designer work is done, edit the form's source code to change the pointer assignment statements to CAST the Strings as a Object types. For example:
Add this definition to subroutine InitializeComponent:
type(System%Object) :: TEMPOBJ
Change the pointer assignment statements for the ListBox or ComboBox:
ASPTMP1( 1 ) => CAST( USTRING("blue"), TEMPOBJ)
ASPTMP1( 2 ) => CAST( USTRING("green"), TEMPOBJ)
ASPTMP1( 3 ) => CAST( USTRING("red"), TEMPOBJ)
Status
Open.
Lahey issue number: FSW-4717
<hr>
The information in this post applies to:
LF Fortran v7.x Enterprise edition
LF Fortran v7.x Academic edition
LF Fortran v7.0 Developer edition
LF Fortran v7.0 Educational edition
Symptoms
When the collection is populated for the items property of a ListBox or ComboBox control, code is generated like this example:
class(System%Object),dimension(:),pointer :: ASPTMP1
...
allocate( ASPTMP1( 3 ) )
ASPTMP1( 1 ) => USTRING("blue")
ASPTMP1( 2 ) => USTRING("green")
ASPTMP1( 3 ) => USTRING("red")
When the form is displayed, all of the items show as "System.Object".
Cause
Bug in the Visual Studio Fortran integration code generator.
Workaround
When your Windows Forms designer work is done, edit the form's source code to change the pointer assignment statements to CAST the Strings as a Object types. For example:
Add this definition to subroutine InitializeComponent:
type(System%Object) :: TEMPOBJ
Change the pointer assignment statements for the ListBox or ComboBox:
ASPTMP1( 1 ) => CAST( USTRING("blue"), TEMPOBJ)
ASPTMP1( 2 ) => CAST( USTRING("green"), TEMPOBJ)
ASPTMP1( 3 ) => CAST( USTRING("red"), TEMPOBJ)
Status
Open.