My favorites | Sign in
Project Home Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
<?xml version="1.0" encoding="ISO-8859-1"?>
<SourceFile><Source><![CDATA[Option Explicit
Implements IJabacoControl
Implements MouseListener
Implements MouseMotionListener
Implements ChangeListener
Implements FocusListener

Event GotFocus()
Event LostFocus()
Event Change()
Event MouseEntered()
Event MouseExited()
Event MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Event MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Event MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)

Dim myMouseIcon As #IResource
Dim myTag As String

' ******************************** INIT THIS CONTROL ********************************

Public Property Get Parent() As JSlider
Parent = Base
End Property

Public Sub Class_Initialize()
Call Parent.setVisible(False)
Call Parent.addFocusListener(Me)
Call Base.setValue(0)
Call Parent.addChangeListener(Me)
Call Parent.addMouseListener(Me)
Call Parent.addMouseMotionListener(Me)
End Sub

' ******************************** DEFAULT FOCUS - EVENTS ********************************

Public Sub focusGained(arg2 As FocusEvent)
Raiseevent GotFocus()
End Sub

Public Sub focusLost(arg2 As FocusEvent)
Raiseevent LostFocus()
End Sub

' ******************************** DEFAULT MOUSE - EVENTS ********************************

Public Sub mouseMoved(e As MouseEvent)
RaiseEvent MouseMove(getVBMouseButton(e),getVBMouseShift(e),e.getX(),e.getY())
End Sub

Public Sub mouseDragged(e As MouseEvent)
RaiseEvent MouseMove(getVBMouseButton(e),getVBMouseShift(e),e.getX(),e.getY())
End Sub

Public Sub mousePressed(e As MouseEvent)
RaiseEvent MouseDown(getVBMouseButton(e),getVBMouseShift(e),e.getX(),e.getY())
End Sub

Public Sub mouseReleased(e As MouseEvent)
RaiseEvent MouseUp(getVBMouseButton(e),getVBMouseShift(e),e.getX(),e.getY())
End Sub

Public Sub mouseClicked(e As MouseEvent)
'done by actionlistener
End Sub

Public Sub mouseEntered(e As MouseEvent)
RaiseEvent MouseEntered()
End Sub

Public Sub mouseExited(e As MouseEvent)
RaiseEvent MouseExited()
End Sub

' ******************************** SPECIAL FUNCTIONS ********************************

Public Property Get BackStyle() As BackStyleConstants
If Me.isOpaque() Then
BackStyle = vbSolid
Else
BackStyle = vbTransparent
End If
End Property

Public Property Let BackStyle(val As BackStyleConstants)
Select Case val
Case vbTransparent
Parent.setOpaque(False)
Case vbSolid
Parent.setOpaque(True)
End Select
End Property

Public Sub stateChanged(e As ChangeEvent)
If Visible Then Raiseevent Change
End Sub

Public Property Let Orientation(v As OrientationConstants)
If v = ccOrientationVertical Then
Base.setInverted True
Else
Base.setInverted False
End If
Base.setOrientation v
End Property

Public Property Get Orientation() As OrientationConstants
Orientation = Base.getOrientation()
End Property

Public Property Let TickStyle(v As TickStyleConstants)
If v = sldNoTicks Then
Call Base.setPaintTicks(False)
Else
Call Base.setPaintTicks(True)
End If
End Property

Public Property Get TickStyle() As TickStyleConstants
If Base.getPaintTicks() Then
TickStyle = sldTopLeft
Else
TickStyle = sldNoTicks
End If
End Property

Public Property Let Min(v As Integer)
Base.setMinimum v
End Property

Public Property Get Min() As Integer
Min = Base.getMinimum()
End Property

Public Property Let Max(v As Integer)
Base.setMaximum v
End Property

Public Property Get Max() As Integer
Max = Base.getMaximum()
End Property

Public Property Let Value(v As Integer)
If Base.getValue() <> v Then
Base.setValue v
End If
End Property

Public Property Get Value() As Integer
Value = Base.getValue()
End Property

Public Property Let SnapToTicks(v As Boolean)
Base.setSnapToTicks v
End Property

Public Property Get SnapToTicks() As Boolean
SnapToTicks = Base.getSnapToTicks()
End Property

Public Property Let TickFrequency(v As Integer)
Base.setMinorTickSpacing 0
Base.setMajorTickSpacing v
End Property

Public Property Get TickFrequency() As Integer
TickFrequency = Base.getMajorTickSpacing()
End Property

Public Property Let PaintLabels(v As Boolean)
Base.setPaintLabels v
End Property

Public Property Get PaintLabels() As Boolean
PaintLabels = Base.getPaintLabels()
End Property








' ******************************** SAME IN ALL JABACO CONTROLS ********************************

Public Property Get FontName() As String
On Error Resume Next
FontName = Parent.getFont.GetFamily()
End Property

Public Property Let FontName(val As String)
On Error Resume Next
Parent.setFont(New Font(val, IIF(FontBold, BOLD, 0) OR IIF(FontItalic, ITALIC, 0), VBFontSizeToJFontSize(FontSize)))
End Property

Public Property Get FontBold() As Boolean
On Error Resume Next
FontBold = Parent.getFont.isBold()
End Property

Public Property Let FontBold(val As Boolean)
On Error Resume Next
Parent.setFont(New Font(FontName, IIF(val, BOLD, 0) OR IIF(FontItalic, ITALIC, 0), VBFontSizeToJFontSize(FontSize)))
End Property

Public Property Get FontItalic() As Boolean
On Error Resume Next
FontItalic = Parent.getFont.isItalic()
End Property

Public Property Let FontItalic(val As Boolean)
On Error Resume Next
Parent.setFont(New Font(FontName, IIF(FontBold, BOLD, 0) OR IIF(val, ITALIC, 0), VBFontSizeToJFontSize(FontSize)))
End Property

Public Property Get FontSize() As Integer
On Error Resume Next
FontSize = (JFontSizeToVBFontSize(Font.getSize()))
End Property

Public Property Let FontSize(val As Integer)
On Error Resume Next
Parent.setFont(New Font(FontName, IIF(FontBold, BOLD, 0) Or IIF(FontItalic, ITALIC, 0), VBFontSizeToJFontSize(val)))
End Property

Public Property Get Font() As Font
Font = Parent.getFont()
End Property

Public Property Get BackColor() As Long
BackColor = ColortoRGB(Base.getBackground())
End Property

Public Property Let BackColor(v As Long)
Base.setBackground(RGBtoColor(v))
End Property

Public Property Get ForeColor() As Long
ForeColor = ColortoRGB(Base.getForeground())
End Property

Public Property Let ForeColor(v As Long)
Base.setForeground(RGBtoColor(v))
End Property

Public Property Get Width() As Single
Width = Me.getSize.Width
End Property

Public Property Let Width(v As Single)
Me.setSize(v, Me.getSize.Height)
End Property

Public Property Get Height() As Single
Height = Me.getSize.Height
End Property

Public Property Let Height(v As Single)
Me.setSize(Me.getSize.Width, v)
End Property

Public Property Get Left() As Single
Left = Me.getLocation.x
End Property

Public Property Let Left(v As Single)
Me.setLocation(v, Me.getLocation.y)
End Property

Public Property Get Top() As Single
Top = Me.getLocation.y
End Property

Public Property Let Top(v As Single)
Me.setLocation(Me.getLocation.x, v)
End Property

Public Function Move(Left As Single, Optional Top As Single = -1, Optional Width As Single = -1, Optional Height As Single = -1)
Me.Left = Left
If Top <> -1 Then Me.Top = Top
If Width <> -1 Then Me.Width = Width
If Height <> -1 Then Me.Height = Height
End Function

Public Property Get ToolTip() As String
ToolTip = Parent.getToolTipText()
End Property

Public Property Let ToolTip(v As String)
If Len(v) = 0 Then
Parent.setToolTipText(Null)
Else
Parent.setToolTipText(v)
End If
End Property

Public Property Get Enabled() As Boolean
Enabled = Base.isEnabled()
End Property

Public Property Let Enabled(v As Boolean)
Call Base.setEnabled(v)
End Property

Public Property Get Visible() As Boolean
Visible = Base.isVisible()
End Property

Public Property Let Visible(v As Boolean)
Base.setVisible v
End Property

Public Property Get Tag() As String
Tag = myTag
End Property

Public Property Let Tag(v As String)
myTag = v
End Property

Public Function toString() As String
toString = Value
End Function

Public Property Get MousePointer() As MousePointerConstants
MousePointer = JCursorToVBMousePointer(Parent.getCursor())
End Property

Public Property Let MousePointer(v As MousePointerConstants)
Call Parent.setCursor(VBMousePointerToJCursor(v))
End Property

Public Property Get MouseIcon() As #IResource
MouseIcon = myMouseIcon
End Property

Public Property Let MouseIcon(v As #IResource)
myMouseIcon = v
Call Parent.setCursor(VBMouseIconToJCursor(v, Me))
End Property

Public Property Get CanGetFocus() As Boolean
CanGetFocus = Parent.isFocusable
End Property

Public Property Let CanGetFocus(v As Boolean)
Parent.setFocusable v
End Property

Public Sub SetFocus()
Parent.requestFocus
End Sub

Public Sub Refresh()
Call Parent.invalidate()
Call Parent.repaint(0, 0, 0, Me.Width, Me.Height)
End Sub





]]></Source><Param Name="(Name)" Value="Slider"/><Param Name="(SuperClass)" Value="javax/swing/JSlider"/><Param Name="(Type)" Value="Class"/><Param Name="(Access)" Value="Public"/><Param Name="(NameSpace)" Value="VB"/></SourceFile>

Change log

r84 by theuse...@hotmail.com on Sep 11, 2011   Diff
Fixed TextBox-caret-bug and bug with BOLD
/non-BOLD fonts. More about it at
http://www.jabaco.org/board/647-no-
blinking-cursor-in-textbox.html
Go to: 
Sign in to write a code review

Older revisions

r9 by man...@makasy.de on Jun 21, 2009   Diff
[No log message]
r6 by man...@makasy.de on Jun 14, 2009   Diff
[No log message]
All revisions of this file

File info

Size: 9533 bytes, 365 lines
Powered by Google Project Hosting