#Region Project Attributes
#MainFormWidth: 500
#MainFormHeight: 400
#End Region
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private xui As XUI
Private Label As Label
Private downx, downy, movex, movey As Float, Resizing As Boolean
Dim gap As Int = 10
Private panOrig As Pane
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("Layout1")
MainForm.Show
End Sub
Private Sub Label_MousePressed (EventData As MouseEvent)
'Log("Pressed")
downx = EventData.x
downy = EventData.y
End Sub
Private Sub Label_MouseReleased (EventData As MouseEvent)
Resizing = False
'Log("Released")
End Sub
Private Sub Label_MouseMoved (EventData As MouseEvent)
If EventData.X > (Label.Width - gap) Or EventData.y > ( Label.Height - gap) Then
Label.MouseCursor = fx.Cursors.OPEN_HAND
Else
Label.MouseCursor = fx.Cursors.MOVE
End If
End Sub
Private Sub panOrig_MouseDragged (EventData As MouseEvent)
Dim deltax, deltay As Float
deltax = EventData.X - movex
deltay = EventData.y - movey
'Log("deltax = " & deltax)
If deltax > 1 Then deltax = 1
If deltax < -1 Then deltax = -1
If deltay > 1 Then deltay = 1
If deltay < -1 Then deltay = -1
If downx > ( Label.prefWidth - gap) And Not(Resizing) Then
Resizing = True
End If
If Resizing Then
Label.PrefWidth = Max( Label.prefWidth + deltax, 50)
Else
Label.Left = Label.Left + deltax
End If
If Label.Left < 0 Then Label.Left = 0
If Label.Left + Label.Width > panOrig.Width Then
Label.PrefWidth = panOrig.Width - Label.Left
End If
If downy > ( Label.Height - gap) And Not(Resizing) Then
Resizing = True
End If
If Resizing Then
Label.PrefHeight = Max( Label.PrefHeight + deltay, 50)
Else
Label.Top = Label.Top + deltay
End If
If Label.Top < 0 Then Label.Top = 0
If Label.Top + Label.Height > panOrig.Height Then
Label.PrefHeight = panOrig.Height - Label.Top
End If
movex = EventData.X
movey = EventData.y
End Sub
Sub Label_Action
If Sender Is MenuItem Then
Dim mi As MenuItem = Sender
Log(mi.Text & " HERE")
Else
Log(Sender & " is not a MenuItem")
End If
End Sub