Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

VB.Net Tablelayout, LayoutEngine

Empfohlene Antworten

Veröffentlicht

Hallo, mal wieder ne Frage^^

Ich hab aktuell das problem, das mir der folgende Code:

Dim ctrl As Control = DirectCast(sender, Control)

            Dim tlp As TableLayoutPanel = CType(ctrl.Parent, TableLayoutPanel)

            Dim row As Integer = tlp.GetPositionFromControl(ctrl).Row

eines Eventlisteners ziemlich seltsame ergebnise produziert. der genannte Listener ist für 2 selbstgeschriebene Button/Combobox Componenten listener. Diese Componeten werden im per Code unten, mehrfach mit unterschiedlichen inizialiserungen einem Tablelayout hinzugefügt.
Function init3Controls(inactiv As Boolean, pma As Projekt_Mitarbeiter, Optional hassubs As Boolean = False, Optional OPXMitarbeiter As Boolean = False) As Control()

            Dim retarray(2) As Control

            Dim cbxRole As New System.Windows.Forms.CheckBox

            Dim cboRoleType As New TeamComboBox(Me)

            Dim btEmployee As New EmployeeButton(pma.Mitarbeiter.ID)



            With cbxRole

                If (inactiv) Then

                    .Checked = False

                End If

                .AutoSize = True

                .Anchor = System.Windows.Forms.AnchorStyles.None

                .Name = pma.ID.ToString

                .TabIndex = 0

                .Text = ""

                AddHandler .CheckedChanged, AddressOf cbxCheckedChangedEvent

                AddHandler .KeyDown, AddressOf KeyDownEvent


            End With


            With cboRoleType

                'If (inactiv) Then

                '    .disableSelection = True

                'End If

                If (hassubs Or inactiv) Then

                    .Enabled = False

                End If

                .Anchor = System.Windows.Forms.AnchorStyles.Left Or System.Windows.Forms.AnchorStyles.Right

                .FormattingEnabled = True

                .Name = pma.ID.ToString

                .AutoCompleteMode = AutoCompleteMode.Suggest

                .AutoCompleteSource = AutoCompleteSource.ListItems

                .DropDownStyle = ComboBoxStyle.DropDownList


                .Items.Add(pma.Rollen_Typ)

                .SelectedIndex = 0

                AddHandler .SelectedIndexChanged, AddressOf ValueChangedEvent

                AddHandler .KeyDown, AddressOf KeyDownEvent

            End With


            With btEmployee

                Dim fo As System.Drawing.Font = .Font


                .Anchor = System.Windows.Forms.AnchorStyles.Left Or System.Windows.Forms.AnchorStyles.Right

                .Name = pma.ID.ToString

                If (hassubs Or inactiv) Then

                    .Enabled = False

                End If

                If Not (inactiv) Then

                    AddHandler .EmployeeChanged, AddressOf ValueChangedEvent

                    AddHandler .KeyDown, AddressOf KeyDownEvent

                    AddHandler .Click, AddressOf BTEmployeeClick

                End If

            End With

            retarray(0) = cbxRole

            retarray(1) = cboRoleType

            retarray(2) = btEmployee

            Return retarray

        End Function

Nun kommt aber später, wenn man einen der Buttons klickt MANCHMAL bei getRow -1 raus. MSDN meinte dazu nur -1 käme raus wenn die LayoutEngine eine Control setzt.

Jetzt ist meine Frage, was sind die Bedingungen für die Layoutengine um eine Control zu setzen?

Denn manche Buttons funktionieren ohne probleme, hier kommt bei getrow der richtige Wert raus, und bei anderen, im gleichen Layout, über die gleiche Schleife erstellt, liefert mir getrow -1.

Hoffe mir kann da jemand die erleuchtung bringen, bin da grad etwas verwirrt, MSDN ist da auch nicht sehr hilfreich da ich hier nirgends gefunden habe WANN diese Engine eine Control setzt.

Gruß

Lucas

  • Autor

UPDATE: ok, dieser komische Fehler kommt sogar bei einem einfachen CheckedChange Listener, der ebenfalls über GetRow laufen muss um eine weitere Componete der Row abzufragen. es hat also nichts speziel mit den eigenen Componeten zutun

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.