StrataFrame Forum

Radio Button Group Problem

http://forum.strataframe.net/Topic28983.aspx

By Terry Bottorff - 11/17/2010

I am using a radio button group and I set it to have 5 radio button count. I set the BO to none since I am supplying the text for the radio buttons. I run it load the form and it looks good. I run it the second time and go back to edit it and all of a sudden I have 7, 9, 13 buttons filled in automatically and showing up on top of each other as the picture shows? I have even uninstalled, downloaded latest version are reinstalled and I get the same thing. 
What could it possibly be? 
TIA.
By Terry Bottorff - 11/17/2010

OP's I forgot the picture.
By Ivan George Borges - 11/17/2010

Hi Terry.

Could you reproduce this on a small sample and attach it here?
By Terry Bottorff - 11/17/2010

I just tried it on a simple form in my project and the attached pictures show the weirdness. This is after I ran my form twice and went back to edit it?

This happened after no intervention by me other than running the form. 

I am going to try on a separate project.
By Ivan George Borges - 11/17/2010

Got it. As soon as you get it happening on your simple project, post it here so we can test it together.
By Terry Bottorff - 11/17/2010

Well I found out what it is I think.
I created a subclass of a button for exiting a form.

Imports System.Drawing
Imports System.ComponentModel
'Imports MicroFour.StrataFrame.Business
Imports MicroFour.StrataFrame.UI.Collections


''' <summary>
''' My Button class.  I will use this class to exit a form.
''' </summary>
''' <remarks></remarks>
<ToolboxBitmap(GetType(System.Windows.Forms.Button))>
Public Class myExitButton
    Inherits MicroFour.StrataFrame.UI.Windows.Forms.Button

    Public Sub New()
        MyBase.New()
        'Me.Width = 23
        'Me.Height = 32
        'Me.Text = "Exit"
    End Sub

    Protected Overrides Sub OnClick(ByVal e As System.EventArgs)
        MyBase.OnClick(e)
        ' Simply Want to Close the Form The Following Works but the following is more generic
        ' Parent.Dispose()

        Dim parentform As Form = Me.GetParentForm()
        If parentform IsNot Nothing Then
            parentform.Close()
        End If


    End Sub

    Protected Overrides Sub oncreatecontrol()
        MyBase.OnCreateControl()
        Me.Width = 75
        Me.Height = 23
        Me.Text = "Exit"
    End Sub

    Private Function GetParentForm() As Object
        ' return var
        Dim parentform As Form = Nothing
        Dim ctl1 As Control = Me.Parent

        If TypeOf ctl1 Is Form Then
            parentform = DirectCast(ctl1, Form)
            Return parentform
        End If

        Do
            ctl1 = Me.GetNextControl(ctl1, True)

            If ctl1 IsNot Nothing Then
                ' Search for Form
                If TypeOf ctl1 Is Form Then
                    parentform = DirectCast(ctl1, Form)
                End If

            End If

        Loop Until ctl1 Is Nothing

        Return parentform

    End Function


    ' The Following would probably work if you wanted to put the Parent Form in a Property
    '    Public Class closebutton
    'imports System.Windows.Forms.Button

    '        Private _parentForm As System.Windows.Forms.Form

    '        '' <summary>
    '        ''' Defines.
    '        ''' </summary>
    '        Public Property ParentForm() As System.Windows.Forms.Form
    '            Get
    '                Return _parentForm
    '            End Get
    '            Set(ByVal value As System.Windows.Forms.Form)
    '                _parentForm = value
    '            End Set
    '        End Property

    '        Protected Overrides Sub OnCreateControl()
    '            MyBase.OnCreateControl()

    '            Me.Text = "Close"
    '            Me.Width = 75
    '            Me.Height = 23
    '        End Sub

    '        Protected Overrides Sub OnClick(ByVal e As EventArgs)
    '            MyBase.OnClick(e)

    '            '-- Close the form if its set.
    '            If Me.ParentForm IsNot Nothing Then
    '                Me.ParentForm.Close()
    '            End If
    '        End Sub

    '    End Class





End Class

As Soon as I put it on the form to exit the weird stuff happens. I have used this on 9 or 10 forms before and nothing happened with Radiobuttongroups. Why all of a sudden???

By Terry Bottorff - 11/17/2010

Wow. Greg helped me develop one also(exit button) that required a form name as an input and now it is doing the same thing.
Imports System.Drawing
Imports System.ComponentModel
'Imports MicroFour.StrataFrame.Business
Imports MicroFour.StrataFrame.UI.Collections
Imports System.Windows.Forms.Button

''' <summary>
''' My Button class.  I will use this class to exit a form.
''' </summary>
''' <remarks></remarks>
<ToolboxBitmap(GetType(System.Windows.Forms.Button))>
Public Class myExitButton2
    Inherits MicroFour.StrataFrame.UI.Windows.Forms.Button

    Private _parentForm As System.Windows.Forms.Form

    Public Property ParentForm() As System.Windows.Forms.Form
        Get
            Return _parentForm
        End Get
        Set(ByVal value As System.Windows.Forms.Form)
            _parentForm = value
        End Set
    End Property

    Protected Overrides Sub OnCreateControl()
        MyBase.OnCreateControl()
        Me.Text = "Close"
        Me.Width = 75
        Me.Height = 23
    End Sub

    Protected Overrides Sub OnClick(ByVal e As EventArgs)
        MyBase.OnClick(e)

        '-- Close the form if its set.
        If Me.ParentForm IsNot Nothing Then
            Me.ParentForm.Close()
        End If
    End Sub


Imports MicroFour.StrataFrame.UI.Collections
The above line is also not correct now?
By Ivan George Borges - 11/17/2010

Could you reproduce this same thing on a simple sample?

About the Imports line, if this was what you were asking last, I can't see anything wrong with it.
By Terry Bottorff - 11/17/2010

Yes even on a simple form both classes create the same problem.

Yes the import has a squiggly line underneath it.
By Ivan George Borges - 11/17/2010

Have you added the MicroFour StrataFrame UI reference into your project?
By Terry Bottorff - 11/17/2010

That took care of the import problem but what is happening with the RadioButtonGroup and the Button Classes?
By Ivan George Borges - 11/17/2010

Good, one thing solved.

Regarding the RadioButtonGroup, I still can't tell you what could be going on. Were you able to write a small sample with a form, a RadioButtonGroup and maybe your Exit button so I could reproduce it here?
By Terry Bottorff - 11/17/2010

Yes, do I zip the entire subdirectory?
By Greg McGuffey - 11/17/2010

You don't need to include the bin or obj folders, they get created when you build the solution.
By Terry Bottorff - 11/17/2010

Alright I'll do it in the morning.
By Terry Bottorff - 11/18/2010

When I first ran this project I only had the radio button group on it and 2 options. No button. Quit and edited and still 2 options. Put myexitbutton on the form and reran the project. Now if you move the options around you will find there are 4 options??????

Now when I try to attach my zip file I get the error found in the picture? The zip is 78000 bytes so not big.
By Ivan George Borges - 11/18/2010

Terry, not sure what might be happening. The only thing I see from your picture is runtime error in '/'. The following is what you have uploaded:

By Terry Bottorff - 11/18/2010

That is all I can see also and then the attachment form will not work any longer.
I'll try sending the zip on a different machine.
By Terry Bottorff - 11/18/2010

Try sending zip from different machine.
 Same error on another machine????
Can not send zip?
By Ivan George Borges - 11/18/2010

Yep, you should be able to send zipped files with no problem.
By Terry Bottorff - 11/19/2010

This is my try at the zip with an older zip program. The last 2 I tried was the newest version of winzip.

There may be a conflict between Winzip V15 or the newest and this system because with the older version of winzip it seems to work?
By Ivan George Borges - 11/19/2010

Yep, I was able to reproduce the issue over here. And I was able to create a work around too. I noticed that this only happens if you run your application with the form open in the designer. On the other hand, if you drop your button on you form, save it, close it, and then run it, it won't happen.

Now we can move on and avoid it. I will see if I can investigate a bit further and find the reason.

Thanks for the sample, Terry.
By Terry Bottorff - 11/19/2010

Wow. I'll try that. Can you tell me why you tried it by saving and closing and then running?
By Ivan George Borges - 11/19/2010

I tried that because I noticed that it happened only once I run the solution. I wondered how the compiler would do that without the form opened, since it would have to find it into the project and do it on purpose. BigGrin So I closed the form and as I guessed nothing happened.

Now, the reason for that is something I will need some more time to investigate and I wasn't able to do it yet.

I hope it has worked for you too. Let us know.
By Terry Bottorff - 11/20/2010

Yes that worked for me also. I just wanted to pick your brain as to why you did what you did. Thank you so much. Let me know if you find out why.
By Ivan George Borges - 11/20/2010

Glad it worked.

You are welcome, Terry! Cool
By Edhy Rijo - 11/20/2010

Terry Bottorff (11/20/2010)
I just wanted to pick your brain as to why you did what you did.


Hey Terry, get in line, you are not the only one w00t