Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CerberusV2 Archive - GUI and Menu Editor
#1
I tried my best to get the coding finished before we left for holiday, but alas time is against me once again!
Just droppped in before we leave to climb a mountain (Snowdon) and thought I'd leave you all with a little teaser of how it's coming along.

GUI Editor progress

Back in 5 days time, laters
.
Update: 02/09/07

Code:
Private Type DesignSelectRec
    Background As Byte
    Control As Byte
    Data1 As Integer
    Data2 As Integer
    Data3 As Integer
    Data4 As Integer
    Data5 As Integer
End Type

Private Selection As DesignSelectRec

Private Selected As Boolean
Private Changed As Boolean

Private Sub Form_Load()
Dim i As Long

    Me.ScaleMode = 3
    Call ResetSelection
    For i = 0 To 7
        shpDesignSelect(i).Visible = False
    Next i
    cmdDesignNext.Enabled = False
    cmdDesignPrevious.Enabled = False
    cmdDesignPreview.Enabled = False
    cmdDesignApply.Enabled = False
    Changed = False
    frmCClient.picScreen.Refresh
End Sub

Private Sub Form_DragDrop(Source As Control, x As Single, y As Single)
    If Selected = False Then
        Source.Move x - MouseXOffset, y - MouseYOffset
        Source.Visible = True
    End If
End Sub

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
    If Button = 2 Then
        Call ResetChanges
        Call ResetSelection
    End If
End Sub

' *******************
' ** Design Editor **
' *******************

Private Sub picDesignEditor_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
    If Button = 2 Then
        Call ResetChanges
        Call ResetSelection
    Else
        If optDesignOption(1).Value = True Then
            MouseXOffset = x
            MouseYOffset = y
            picDesignEditor.Drag vbBeginDrag
        End If
    End If
End Sub

Private Sub cmdDesignNext_Click()
    If Selection.Control = 0 Then
        If Selection.Background > 0 Then
            picDesignBackground(Selection.Background).Picture = LoadPicture(App.Path & DESIGN_PATH & Selection.Background & "\" & (lblDesignPicNum.Caption + 1) & GFX_EXT)
            lblDesignPicNum.Caption = (lblDesignPicNum.Caption + 1)
            Selection.Data5 = Val(lblDesignPicNum.Caption)
            If FileExist(DESIGN_PATH & Selection.Background & "\" & (lblDesignPicNum.Caption + 1) & GFX_EXT, False) Then
                cmdDesignNext.Enabled = True
            Else
                cmdDesignNext.Enabled = False
            End If
            If FileExist(DESIGN_PATH & Selection.Background & "\" & (lblDesignPicNum.Caption - 1) & GFX_EXT, False) Or (lblDesignPicNum.Caption - 1 = 0) Then
                cmdDesignPrevious.Enabled = True
            Else
                cmdDesignPrevious.Enabled = False
            End If
            Changed = True
            cmdDesignApply.Enabled = True
        End If
    End If
End Sub

Private Sub cmdDesignPrevious_Click()
    If Selection.Control = 0 Then
        If (lblDesignPicNum.Caption - 1) > 0 Then
            picDesignBackground(Selection.Background).Picture = LoadPicture(App.Path & DESIGN_PATH & Selection.Background & "\" & (lblDesignPicNum.Caption - 1) & GFX_EXT)
        Else
            picDesignBackground(Selection.Background).Picture = LoadPicture()
        End If
        lblDesignPicNum.Caption = (lblDesignPicNum.Caption - 1)
        Selection.Data5 = Val(lblDesignPicNum.Caption)
        If FileExist(DESIGN_PATH & Selection.Background & "\" & (lblDesignPicNum.Caption + 1) & GFX_EXT, False) Then
            cmdDesignNext.Enabled = True
        Else
            cmdDesignNext.Enabled = False
        End If
        If FileExist(DESIGN_PATH & Selection.Background & "\" & (lblDesignPicNum.Caption - 1) & GFX_EXT, False) Then
            cmdDesignPrevious.Enabled = True
        Else
            cmdDesignPrevious.Enabled = False
        End If
        Changed = True
        cmdDesignApply.Enabled = True
    End If
End Sub

Private Sub cmdDesignPreview_Click()
Dim n As Long

    If Selected = True And Changed = True Then
        ' Change selection values
        Selection.Data3 = Int(Val(txtDesignHeight.Text))
        Selection.Data4 = Int(Val(txtDesignWidth.Text))
        If Selection.Control = 0 And Selection.Background > 0 Then
            ' Show preview
            picDesignBackground(Selection.Background).Height = Selection.Data3
            picDesignBackground(Selection.Background).Width = Selection.Data4
            Call UpdateBackgroundSelection(Selection.Background)
        Else
            n = Selection.Control
            Select Case Selection.Background
                Case 1
                    lblDesignMenu(n).Height = Selection.Data3
                    lblDesignMenu(n).Width = Selection.Data4
                    Call UpdateControlSelection(n, Selection.Background)
                    
                Case 2
                    lblDesignLogin(n).Height = Selection.Data3
                    lblDesignLogin(n).Width = Selection.Data4
                    Call UpdateControlSelection(n, Selection.Background)
                    
                Case 3
                    lblDesignNewAcc(n).Height = Selection.Data3
                    lblDesignNewAcc(n).Width = Selection.Data4
                    Call UpdateControlSelection(n, Selection.Background)
                    
                Case 4
                    lblDesignDelAcc(n).Height = Selection.Data3
                    lblDesignDelAcc(n).Width = Selection.Data4
                    Call UpdateControlSelection(n, Selection.Background)
                    
                Case 5
                    lblDesignCredits(n).Height = Selection.Data3
                    lblDesignCredits(n).Width = Selection.Data4
                    Call UpdateControlSelection(n, Selection.Background)
                    
                Case 6
                    lblDesignChars(n).Height = Selection.Data3
                    lblDesignChars(n).Width = Selection.Data4
                    Call UpdateControlSelection(n, Selection.Background)
                    
                Case 7
                    lblDesignNewChar(n).Height = Selection.Data3
                    lblDesignNewChar(n).Width = Selection.Data4
                    Call UpdateControlSelection(n, Selection.Background)
            End Select
        End If
        cmdDesignPreview.Enabled = False
        cmdDesignApply.Enabled = True
    End If
End Sub

Private Sub cmdDesignApply_Click()
Dim i As Long
Dim n As Long

    If Selected = True And Changed = True Then
        i = Selection.Background
        n = Selection.Control
        If Selection.Control = 0 And Selection.Background > 0 Then
            'Apply changes to background
            GUI(EditorIndex).Background(i).Data1 = Selection.Data1
            GUI(EditorIndex).Background(i).Data2 = Selection.Data2
            GUI(EditorIndex).Background(i).Data3 = Selection.Data3
            GUI(EditorIndex).Background(i).Data4 = Selection.Data4
            GUI(EditorIndex).Background(i).Data5 = Selection.Data5
        Else
            Select Case Selection.Background
                Case 1
                    GUI(EditorIndex).Menu(n).Data1 = Selection.Data1
                    GUI(EditorIndex).Menu(n).Data2 = Selection.Data2
                    GUI(EditorIndex).Menu(n).Data3 = Selection.Data3
                    GUI(EditorIndex).Menu(n).Data4 = Selection.Data4
                    
                Case 2
                    GUI(EditorIndex).Login(n).Data1 = Selection.Data1
                    GUI(EditorIndex).Login(n).Data2 = Selection.Data2
                    GUI(EditorIndex).Login(n).Data3 = Selection.Data3
                    GUI(EditorIndex).Login(n).Data4 = Selection.Data4
                    
                Case 3
                    GUI(EditorIndex).NewAcc(n).Data1 = Selection.Data1
                    GUI(EditorIndex).NewAcc(n).Data2 = Selection.Data2
                    GUI(EditorIndex).NewAcc(n).Data3 = Selection.Data3
                    GUI(EditorIndex).NewAcc(n).Data4 = Selection.Data4
                    
                Case 4
                    GUI(EditorIndex).DelAcc(n).Data1 = Selection.Data1
                    GUI(EditorIndex).DelAcc(n).Data2 = Selection.Data2
                    GUI(EditorIndex).DelAcc(n).Data3 = Selection.Data3
                    GUI(EditorIndex).DelAcc(n).Data4 = Selection.Data4
                    
                Case 5
                    GUI(EditorIndex).Credits(n).Data1 = Selection.Data1
                    GUI(EditorIndex).Credits(n).Data2 = Selection.Data2
                    GUI(EditorIndex).Credits(n).Data3 = Selection.Data3
                    GUI(EditorIndex).Credits(n).Data4 = Selection.Data4
                    
                Case 6
                    GUI(EditorIndex).Chars(n).Data1 = Selection.Data1
                    GUI(EditorIndex).Chars(n).Data2 = Selection.Data2
                    GUI(EditorIndex).Chars(n).Data3 = Selection.Data3
                    GUI(EditorIndex).Chars(n).Data4 = Selection.Data4
                    
                Case 7
                    GUI(EditorIndex).NewChar(n).Data1 = Selection.Data1
                    GUI(EditorIndex).NewChar(n).Data2 = Selection.Data2
                    GUI(EditorIndex).NewChar(n).Data3 = Selection.Data3
                    GUI(EditorIndex).NewChar(n).Data4 = Selection.Data4
            End Select
        End If
        Changed = False
        Call ResetSelection
    End If
End Sub

Private Sub optDesignOption_MouseDown(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
Dim i As Long
    
    If Index = 1 Then
        For i = 1 To 5
            lblDesignMenu(i).Visible = True
        Next i
    Else
        For i = 1 To 5
            lblDesignMenu(i).Visible = False
        Next i
    End If
    For i = 2 To 7
        If Index = i Then
            picDesignBackground(i).Visible = True
        Else
            picDesignBackground(i).Visible = False
        End If
    Next i
End Sub

Private Sub txtDesignHeight_KeyPress(KeyAscii As Integer)
    cmdDesignPreview.Enabled = True
    Changed = True
    If (KeyAscii = vbKeyReturn) Then Call cmdDesignPreview_Click
End Sub

Private Sub txtDesignWidth_KeyPress(KeyAscii As Integer)
    cmdDesignPreview.Enabled = True
    Changed = True
    If (KeyAscii = vbKeyReturn) Then Call cmdDesignPreview_Click
End Sub

Private Sub cmdDesignSend_Click()
    Call GUIEditorSend
End Sub

Private Sub cmdDesignCancel_Click()
    Call GUIEditorCancel
End Sub

' **************************
' ** Selection processing **
' **************************

Private Sub ResetSelection()
Dim i As Long

    If Selected = True And Changed = False Then
        For i = 0 To 7
            shpDesignSelect(i).Visible = False
        Next i
        Selection.Background = 0
        Selection.Control = 0
        Selection.Data1 = 0
        Selection.Data2 = 0
        Selection.Data3 = 0
        Selection.Data4 = 0
        Selection.Data5 = 0
        fraDesignSelected.Visible = False
        If txtDesignHeight.Enabled = False Then txtDesignHeight.Enabled = True
        If txtDesignWidth.Enabled = False Then txtDesignWidth.Enabled = True
        txtDesignHeight.Text = "0"
        txtDesignWidth.Text = "0"
        lblDesignPicNum.Caption = "0"
        cmdDesignPrevious.Enabled = False
        cmdDesignNext.Enabled = False
        cmdDesignPreview.Enabled = False
        Selected = False
    End If
End Sub

Private Sub ResetChanges()
Dim i As Long
Dim n As Long

    i = Selection.Background
    n = Selection.Control
    If Selected = True And Changed = True Then
        If n = 0 And i > 0 Then
            picDesignBackground(i).Left = GUI(EditorIndex).Background(i).Data1
            picDesignBackground(i).Top = GUI(EditorIndex).Background(i).Data2
            picDesignBackground(i).Height = GUI(EditorIndex).Background(i).Data3
            picDesignBackground(i).Width = GUI(EditorIndex).Background(i).Data4
            If GUI(EditorIndex).Background(i).Data5 > 0 Then
                picDesignBackground(i).Picture = LoadPicture(App.Path & DESIGN_PATH & i & "\" & GUI(EditorIndex).Background(i).Data5 & GFX_EXT)
            Else
                picDesignBackground(i).Picture = LoadPicture()
            End If
        Else
            Select Case i
                Case 1
                    lblDesignMenu(n).Left = GUI(EditorIndex).Menu(n).Data1
                    lblDesignMenu(n).Top = GUI(EditorIndex).Menu(n).Data2
                    lblDesignMenu(n).Height = GUI(EditorIndex).Menu(n).Data3
                    lblDesignMenu(n).Width = GUI(EditorIndex).Menu(n).Data4
                    
                Case 2
                    lblDesignLogin(n).Left = GUI(EditorIndex).Login(n).Data1
                    lblDesignLogin(n).Top = GUI(EditorIndex).Login(n).Data2
                    lblDesignLogin(n).Height = GUI(EditorIndex).Login(n).Data3
                    lblDesignLogin(n).Width = GUI(EditorIndex).Login(n).Data4
                    
                Case 3
                    lblDesignNewAcc(n).Left = GUI(EditorIndex).NewAcc(n).Data1
                    lblDesignNewAcc(n).Top = GUI(EditorIndex).NewAcc(n).Data2
                    lblDesignNewAcc(n).Height = GUI(EditorIndex).NewAcc(n).Data3
                    lblDesignNewAcc(n).Width = GUI(EditorIndex).NewAcc(n).Data4
                    
                Case 4
                    lblDesignDelAcc(n).Left = GUI(EditorIndex).DelAcc(n).Data1
                    lblDesignDelAcc(n).Top = GUI(EditorIndex).DelAcc(n).Data2
                    lblDesignDelAcc(n).Height = GUI(EditorIndex).DelAcc(n).Data3
                    lblDesignDelAcc(n).Width = GUI(EditorIndex).DelAcc(n).Data4
                    
                Case 5
                    lblDesignCredits(n).Left = GUI(EditorIndex).Credits(n).Data1
                    lblDesignCredits(n).Top = GUI(EditorIndex).Credits(n).Data2
                    lblDesignCredits(n).Height = GUI(EditorIndex).Credits(n).Data3
                    lblDesignCredits(n).Width = GUI(EditorIndex).Credits(n).Data4
                    
                Case 6
                    lblDesignChars(n).Left = GUI(EditorIndex).Chars(n).Data1
                    lblDesignChars(n).Top = GUI(EditorIndex).Chars(n).Data2
                    lblDesignChars(n).Height = GUI(EditorIndex).Chars(n).Data3
                    lblDesignChars(n).Width = GUI(EditorIndex).Chars(n).Data4
                    
                Case 7
                    lblDesignNewChar(n).Left = GUI(EditorIndex).NewChar(n).Data1
                    lblDesignNewChar(n).Top = GUI(EditorIndex).NewChar(n).Data2
                    lblDesignNewChar(n).Height = GUI(EditorIndex).NewChar(n).Data3
                    lblDesignNewChar(n).Width = GUI(EditorIndex).NewChar(n).Data4
            End Select
        End If
        Changed = False
        cmdDesignApply.Enabled = False
    End If
End Sub

Private Sub UpdateBackgroundSelection(ByVal Background As Byte)
    If Background > 0 Then
        ' Use a different selection highlight if main menu background selected
        If Background = 1 Then
            fraDesignSelected.Visible = True
            shpDesignSelect(0).Width = picDesignBackground(Background).Width + 3
            shpDesignSelect(0).Height = picDesignBackground(Background).Height + 3
            shpDesignSelect(0).Top = picDesignBackground(Background).Top - 1
            shpDesignSelect(0).Left = picDesignBackground(Background).Left - 1
            shpDesignSelect(0).Visible = True
            txtDesignHeight.Text = picDesignBackground(Background).Height
            txtDesignWidth.Text = picDesignBackground(Background).Width
            fraDesignSelected.Caption = "Menu Background"
            lblDesignPicNum.Caption = STR(Selection.Data5)
            If FileExist(DESIGN_PATH & Background & "\" & (lblDesignPicNum.Caption + 1) & GFX_EXT, False) Then
                cmdDesignNext.Enabled = True
            Else
                cmdDesignNext.Enabled = False
            End If
            If FileExist(DESIGN_PATH & Background & "\" & (lblDesignPicNum.Caption - 1) & GFX_EXT, False) Then
                cmdDesignPrevious.Enabled = True
            Else
                cmdDesignPrevious.Enabled = False
            End If
        Else
            fraDesignSelected.Visible = True
            shpDesignSelect(1).Width = picDesignBackground(Background).Width + 3
            shpDesignSelect(1).Height = picDesignBackground(Background).Height + 3
            shpDesignSelect(1).Top = picDesignBackground(Background).Top - 1
            shpDesignSelect(1).Left = picDesignBackground(Background).Left - 1
            shpDesignSelect(1).Visible = True
            txtDesignHeight.Text = picDesignBackground(Background).Height
            txtDesignWidth.Text = picDesignBackground(Background).Width
            Select Case Background
                Case 2
                    fraDesignSelected.Caption = "Login Background"
                    
                Case 3
                    fraDesignSelected.Caption = "New Account Background"
                    
                Case 4
                    fraDesignSelected.Caption = "Delete Account Background"
                    
                Case 5
                    fraDesignSelected.Caption = "Credits Background"
                    
                Case 6
                    fraDesignSelected.Caption = "Select Character Background"
                    
                Case 7
                    fraDesignSelected.Caption = "New Character Background"
            End Select
            lblDesignPicNum.Caption = STR(Selection.Data5)
            If FileExist(DESIGN_PATH & Background & "\" & (lblDesignPicNum.Caption + 1) & GFX_EXT, False) Then
                cmdDesignNext.Enabled = True
            Else
                cmdDesignNext.Enabled = False
            End If
            If FileExist(DESIGN_PATH & Background & "\" & (lblDesignPicNum.Caption - 1) & GFX_EXT, False) Then
                cmdDesignPrevious.Enabled = True
            Else
                cmdDesignPrevious.Enabled = False
            End If
        End If
    End If
End Sub

Private Sub UpdateControlSelection(ByVal Controll As Byte, ByVal Background As Byte)
    fraDesignSelected.Visible = True
    Select Case Background
        Case 1
            fraDesignSelected.Caption = "Menu Component"
            shpDesignSelect(Background).Width = lblDesignMenu(Controll).Width + 3
            shpDesignSelect(Background).Height = lblDesignMenu(Controll).Height + 3
            shpDesignSelect(Background).Top = lblDesignMenu(Controll).Top - 1
            shpDesignSelect(Background).Left = lblDesignMenu(Controll).Left - 1
            shpDesignSelect(Background).Visible = True
            txtDesignHeight.Text = lblDesignMenu(Controll).Height
            txtDesignWidth.Text = lblDesignMenu(Controll).Width
        Case 2
            fraDesignSelected.Caption = "Login Component"
            shpDesignSelect(Background).Width = lblDesignLogin(Controll).Width + 3
            shpDesignSelect(Background).Height = lblDesignLogin(Controll).Height + 3
            shpDesignSelect(Background).Top = lblDesignLogin(Controll).Top - 1
            shpDesignSelect(Background).Left = lblDesignLogin(Controll).Left - 1
            shpDesignSelect(Background).Visible = True
            txtDesignHeight.Text = lblDesignLogin(Controll).Height
            txtDesignWidth.Text = lblDesignLogin(Controll).Width
                    
        Case 3
            fraDesignSelected.Caption = "New Account Component"
            shpDesignSelect(Background).Width = lblDesignNewAcc(Controll).Width + 3
            shpDesignSelect(Background).Height = lblDesignNewAcc(Controll).Height + 3
            shpDesignSelect(Background).Top = lblDesignNewAcc(Controll).Top - 1
            shpDesignSelect(Background).Left = lblDesignNewAcc(Controll).Left - 1
            shpDesignSelect(Background).Visible = True
            txtDesignHeight.Text = lblDesignNewAcc(Controll).Height
            txtDesignWidth.Text = lblDesignNewAcc(Controll).Width
                    
        Case 4
            fraDesignSelected.Caption = "Delete Account Component"
            shpDesignSelect(Background).Width = lblDesignDelAcc(Controll).Width + 3
            shpDesignSelect(Background).Height = lblDesignDelAcc(Controll).Height + 3
            shpDesignSelect(Background).Top = lblDesignDelAcc(Controll).Top - 1
            shpDesignSelect(Background).Left = lblDesignDelAcc(Controll).Left - 1
            shpDesignSelect(Background).Visible = True
            txtDesignHeight.Text = lblDesignDelAcc(Controll).Height
            txtDesignWidth.Text = lblDesignDelAcc(Controll).Width
                    
        Case 5
            fraDesignSelected.Caption = "Credits Component"
            shpDesignSelect(Background).Width = lblDesignCredits(Controll).Width + 3
            shpDesignSelect(Background).Height = lblDesignCredits(Controll).Height + 3
            shpDesignSelect(Background).Top = lblDesignCredits(Controll).Top - 1
            shpDesignSelect(Background).Left = lblDesignCredits(Controll).Left - 1
            shpDesignSelect(Background).Visible = True
            txtDesignHeight.Text = lblDesignCredits(Controll).Height
            txtDesignWidth.Text = lblDesignCredits(Controll).Width
                    
        Case 6
            fraDesignSelected.Caption = "Select Character Component"
            shpDesignSelect(Background).Width = lblDesignChars(Controll).Width + 3
            shpDesignSelect(Background).Height = lblDesignChars(Controll).Height + 3
            shpDesignSelect(Background).Top = lblDesignChars(Controll).Top - 1
            shpDesignSelect(Background).Left = lblDesignChars(Controll).Left - 1
            shpDesignSelect(Background).Visible = True
            txtDesignHeight.Text = lblDesignChars(Controll).Height
            txtDesignWidth.Text = lblDesignChars(Controll).Width
                    
        Case 7
            fraDesignSelected.Caption = "New Character Component"
            shpDesignSelect(Background).Width = lblDesignNewChar(Controll).Width + 3
            shpDesignSelect(Background).Height = lblDesignNewChar(Controll).Height + 3
            shpDesignSelect(Background).Top = lblDesignNewChar(Controll).Top - 1
            shpDesignSelect(Background).Left = lblDesignNewChar(Controll).Left - 1
            shpDesignSelect(Background).Visible = True
            txtDesignHeight.Text = lblDesignNewChar(Controll).Height
            txtDesignWidth.Text = lblDesignNewChar(Controll).Width
    End Select
End Sub

Private Sub picDesignBackground_MouseDown(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
    If Button = 2 Then
        If Changed = False Then
            Call ResetSelection
        Else
            Call ResetChanges
            Call ResetSelection
        End If
    Else
        If Index = 1 And optDesignOption(1).Value = False Then Exit Sub
        If Selected = False Then
            Selection.Background = Index
            Selection.Control = 0
            Selection.Data1 = GUI(EditorIndex).Background(Index).Data1
            Selection.Data2 = GUI(EditorIndex).Background(Index).Data2
            Selection.Data3 = GUI(EditorIndex).Background(Index).Data3
            Selection.Data4 = GUI(EditorIndex).Background(Index).Data4
            Selection.Data5 = GUI(EditorIndex).Background(Index).Data5
            Selected = True
            Call UpdateBackgroundSelection(Selection.Background)
        End If
        If Index  1 And Selection.Control = 0 Then
            MouseXOffset = x
            MouseYOffset = y
            picDesignBackground(Index).Drag vbBeginDrag
        End If
    End If
End Sub

Private Sub picDesignBackground_DragDrop(Index As Integer, Source As Control, x As Single, y As Single)
    If Selection.Control = 0 Then
        ' Check if we're dropping the background onto itself
        If Index > 1 Then
            Source.Move x - MouseXOffset + Source.Left, y - MouseYOffset + Source.Top
        Else
            Source.Move x - MouseXOffset, y - MouseYOffset
        End If
        shpDesignSelect(1).Top = Source.Top - 1
        shpDesignSelect(1).Left = Source.Left - 1
        Selection.Data1 = picDesignBackground(Selection.Background).Left
        Selection.Data2 = picDesignBackground(Selection.Background).Top
    Else
        ' Check we're dropping the control on the right background
        If Selection.Background  Index Then Exit Sub
        
        Source.Move x - MouseXOffset, y - MouseYOffset
        shpDesignSelect(Selection.Background).Top = Source.Top - 1
        shpDesignSelect(Selection.Background).Left = Source.Left - 1
        Select Case Selection.Background
            Case 1
                Selection.Data1 = lblDesignMenu(Selection.Control).Left
                Selection.Data2 = lblDesignMenu(Selection.Control).Top
                
            Case 2
                Selection.Data1 = lblDesignLogin(Selection.Control).Left
                Selection.Data2 = lblDesignLogin(Selection.Control).Top
                
            Case 3
                Selection.Data1 = lblDesignNewAcc(Selection.Control).Left
                Selection.Data2 = lblDesignNewAcc(Selection.Control).Top
                
            Case 4
                Selection.Data1 = lblDesignDelAcc(Selection.Control).Left
                Selection.Data2 = lblDesignDelAcc(Selection.Control).Top
                
            Case 5
                Selection.Data1 = lblDesignCredits(Selection.Control).Left
                Selection.Data2 = lblDesignCredits(Selection.Control).Top
                
            Case 6
                Selection.Data1 = lblDesignChars(Selection.Control).Left
                Selection.Data2 = lblDesignChars(Selection.Control).Top
                
            Case 7
                Selection.Data1 = lblDesignNewChar(Selection.Control).Left
                Selection.Data2 = lblDesignNewChar(Selection.Control).Top
        End Select
    End If
    Source.Visible = True
    cmdDesignApply.Enabled = True
    Changed = True
End Sub

Private Sub lblDesignMenu_MouseDown(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
    If Selected = False Then
        Selection.Background = 1
        Selection.Control = Index
        Selection.Data1 = GUI(EditorIndex).Menu(Index).Data1
        Selection.Data2 = GUI(EditorIndex).Menu(Index).Data2
        Selection.Data3 = GUI(EditorIndex).Menu(Index).Data3
        Selection.Data4 = GUI(EditorIndex).Menu(Index).Data4
        Selection.Data5 = 0
        Selected = True
        Call UpdateControlSelection(Selection.Control, Selection.Background)
    End If
    If Selection.Control = Index Then
        MouseXOffset = Int(x / 15)
        MouseYOffset = Int(y / 15)
        lblDesignMenu(Index).Drag vbBeginDrag
    End If
End Sub

Private Sub lblDesignMenu_DragDrop(Index As Integer, Source As Control, x As Single, y As Single)
    Source.Move Int(x / 15) - MouseXOffset + lblDesignMenu(Index).Left, Int(y / 15) - MouseYOffset + lblDesignMenu(Index).Top
    shpDesignSelect(Selection.Background).Top = Source.Top - 1
    shpDesignSelect(Selection.Background).Left = Source.Left - 1
    Source.Visible = True
    cmdDesignApply.Enabled = True
    Changed = True
End Sub

Private Sub lblDesignLogin_MouseDown(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
    If Selected = False Then
        Selection.Background = 2
        Selection.Control = Index
        Selection.Data1 = GUI(EditorIndex).Login(Index).Data1
        Selection.Data2 = GUI(EditorIndex).Login(Index).Data2
        Selection.Data3 = GUI(EditorIndex).Login(Index).Data3
        Selection.Data4 = GUI(EditorIndex).Login(Index).Data4
        Selection.Data5 = 0
        Selected = True
        Call UpdateControlSelection(Selection.Control, Selection.Background)
    End If
    If Selection.Control = Index Then
        MouseXOffset = Int(x / 15)
        MouseYOffset = Int(y / 15)
        lblDesignLogin(Index).Drag vbBeginDrag
    End If
End Sub

Private Sub lblDesignLogin_DragDrop(Index As Integer, Source As Control, x As Single, y As Single)
    If Selection.Control > 0 Then
        Source.Move Int(x / 15) - MouseXOffset + lblDesignLogin(Index).Left, Int(y / 15) - MouseYOffset + lblDesignLogin(Index).Top
        shpDesignSelect(Selection.Background).Top = Source.Top - 1
        shpDesignSelect(Selection.Background).Left = Source.Left - 1
        Source.Visible = True
        cmdDesignApply.Enabled = True
        Changed = True
    End If
End Sub

Private Sub lblDesignNewAcc_MouseDown(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
    If Selected = False Then
        Selection.Background = 3
        Selection.Control = Index
        Selection.Data1 = GUI(EditorIndex).NewAcc(Index).Data1
        Selection.Data2 = GUI(EditorIndex).NewAcc(Index).Data2
        Selection.Data3 = GUI(EditorIndex).NewAcc(Index).Data3
        Selection.Data4 = GUI(EditorIndex).NewAcc(Index).Data4
        Selection.Data5 = 0
        Selected = True
        Call UpdateControlSelection(Selection.Control, Selection.Background)
    End If
    If Selection.Control = Index Then
        MouseXOffset = Int(x / 15)
        MouseYOffset = Int(y / 15)
        lblDesignNewAcc(Index).Drag vbBeginDrag
    End If
End Sub

Private Sub lblDesignNewAcc_DragDrop(Index As Integer, Source As Control, x As Single, y As Single)
    If Selection.Control > 0 Then
        Source.Move Int(x / 15) - MouseXOffset + lblDesignNewAcc(Index).Left, Int(y / 15) - MouseYOffset + lblDesignNewAcc(Index).Top
        shpDesignSelect(Selection.Background).Top = Source.Top - 1
        shpDesignSelect(Selection.Background).Left = Source.Left - 1
        Source.Visible = True
        cmdDesignApply.Enabled = True
        Changed = True
    End If
End Sub

Private Sub lblDesignDelAcc_MouseDown(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
    If Selected = False Then
        Selection.Background = 4
        Selection.Control = Index
        Selection.Data1 = GUI(EditorIndex).DelAcc(Index).Data1
        Selection.Data2 = GUI(EditorIndex).DelAcc(Index).Data2
        Selection.Data3 = GUI(EditorIndex).DelAcc(Index).Data3
        Selection.Data4 = GUI(EditorIndex).DelAcc(Index).Data4
        Selection.Data5 = 0
        Selected = True
        Call UpdateControlSelection(Selection.Control, Selection.Background)
    End If
    If Selection.Control = Index Then
        MouseXOffset = Int(x / 15)
        MouseYOffset = Int(y / 15)
        lblDesignDelAcc(Index).Drag vbBeginDrag
    End If
End Sub

Private Sub lblDesignDelAcc_DragDrop(Index As Integer, Source As Control, x As Single, y As Single)
    If Selection.Control > 0 Then
        Source.Move Int(x / 15) - MouseXOffset + lblDesignDelAcc(Index).Left, Int(y / 15) - MouseYOffset + lblDesignDelAcc(Index).Top
        shpDesignSelect(Selection.Background).Top = Source.Top - 1
        shpDesignSelect(Selection.Background).Left = Source.Left - 1
        Source.Visible = True
        cmdDesignApply.Enabled = True
        Changed = True
    End If
End Sub

Private Sub lblDesignCredits_MouseDown(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
    If Selected = False Then
        Selection.Background = 5
        Selection.Control = Index
        Selection.Data1 = GUI(EditorIndex).Credits(Index).Data1
        Selection.Data2 = GUI(EditorIndex).Credits(Index).Data2
        Selection.Data3 = GUI(EditorIndex).Credits(Index).Data3
        Selection.Data4 = GUI(EditorIndex).Credits(Index).Data4
        Selection.Data5 = 0
        Selected = True
        Call UpdateControlSelection(Selection.Control, Selection.Background)
    End If
    If Selection.Control = Index Then
        MouseXOffset = Int(x / 15)
        MouseYOffset = Int(y / 15)
        lblDesignCredits(Index).Drag vbBeginDrag
    End If
End Sub

Private Sub lblDesignCredits_DragDrop(Index As Integer, Source As Control, x As Single, y As Single)
    If Selection.Control > 0 Then
        Source.Move Int(x / 15) - MouseXOffset + lblDesignCredits(Index).Left, Int(y / 15) - MouseYOffset + lblDesignCredits(Index).Top
        shpDesignSelect(Selection.Background).Top = Source.Top - 1
        shpDesignSelect(Selection.Background).Left = Source.Left - 1
        Source.Visible = True
        cmdDesignApply.Enabled = True
        Changed = True
    End If
End Sub

Private Sub lblDesignChars_MouseDown(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
    If Selected = False Then
        Selection.Background = 6
        Selection.Control = Index
        Selection.Data1 = GUI(EditorIndex).Chars(Index).Data1
        Selection.Data2 = GUI(EditorIndex).Chars(Index).Data2
        Selection.Data3 = GUI(EditorIndex).Chars(Index).Data3
        Selection.Data4 = GUI(EditorIndex).Chars(Index).Data4
        Selection.Data5 = 0
        Selected = True
        Call UpdateControlSelection(Selection.Control, Selection.Background)
    End If
    If Selection.Control = Index Then
        MouseXOffset = Int(x / 15)
        MouseYOffset = Int(y / 15)
        lblDesignChars(Index).Drag vbBeginDrag
    End If
End Sub

Private Sub lblDesignChars_DragDrop(Index As Integer, Source As Control, x As Single, y As Single)
    If Selection.Control > 0 Then
        Source.Move Int(x / 15) - MouseXOffset + lblDesignChars(Index).Left, Int(y / 15) - MouseYOffset + lblDesignChars(Index).Top
        shpDesignSelect(Selection.Background).Top = Source.Top - 1
        shpDesignSelect(Selection.Background).Left = Source.Left - 1
        Source.Visible = True
        cmdDesignApply.Enabled = True
        Changed = True
    End If
End Sub

Private Sub lblDesignNewChar_MouseDown(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
    If Selected = False Then
        Selection.Background = 7
        Selection.Control = Index
        Selection.Data1 = GUI(EditorIndex).NewChar(Index).Data1
        Selection.Data2 = GUI(EditorIndex).NewChar(Index).Data2
        Selection.Data3 = GUI(EditorIndex).NewChar(Index).Data3
        Selection.Data4 = GUI(EditorIndex).NewChar(Index).Data4
        Selection.Data5 = 0
        Selected = True
        If Index = 9 Or Index = 10 Or Index = 13 Or Index = 14 Then
            Call UpdateControlSelection(Selection.Control, Selection.Background)
        Else
            txtDesignHeight.Enabled = False
            txtDesignWidth.Enabled = False
            Call UpdateControlSelection(Selection.Control, Selection.Background)
        End If
    End If
    If Selection.Control = Index Then
        MouseXOffset = Int(x / 15)
        MouseYOffset = Int(y / 15)
        lblDesignNewChar(Index).Drag vbBeginDrag
    End If
End Sub

Private Sub lblDesignNewChar_DragDrop(Index As Integer, Source As Control, x As Single, y As Single)
    If Selection.Control > 0 Then
        Source.Move Int(x / 15) - MouseXOffset + lblDesignNewChar(Index).Left, Int(y / 15) - MouseYOffset + lblDesignNewChar(Index).Top
        shpDesignSelect(Selection.Background).Top = Source.Top - 1
        shpDesignSelect(Selection.Background).Left = Source.Left - 1
        Source.Visible = True
        cmdDesignApply.Enabled = True
        Changed = True
    End If
End Sub
#2
Looks cool, good job.
#3
looks really nice!
#4
Thnxs guys, back from hols feeling refreshed but knackered.
Just got the selection subs to sort out and then to test it, should be something in a release some time around the weekend.
#5
Awesome
#6
This is my first real coding exploit, not just moving, copying or re-organising code already available in Mirage Source.

I've added the design form code to my first post, if some kind soul has the time, would they please have a look through it and see what they think. Maybe suggest someways it could be improved or optimised.
Are there ways or other methods to acheive the same result that I may not have learnt yet?
I'm sure it's pretty apparent the influence working with Mirage has had on how I've structured it, lol.

Many thanks in advance.


Forum Jump:


Users browsing this thread: 1 Guest(s)