Dear visitor, welcome to Jabaco - Community. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.
Source code |
|
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 |
Option Explicit Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" ( _ ByVal hwnd As Long, _ ByVal wMsg As Long, _ ByVal wParam As Long, _ ByVal lParam As Any) _ As Long Const WM_VSCROLL = &H115 Const SB_LINEUP = 0 Const SB_LINEDOWN = 1 Const SB_PAGEUP = 2 Const SB_PAGEDOWN = 3 Const SB_TOP = 6 Const SB_BOTTOM = 7 Private Sub Command1_Click() Dim i As Long 'If Index = 0 Then For i = List1.ListCount To List1.ListCount + 14 List1.AddItem "neuer eintrag " & i Next i 'End If End Sub Private Sub Command2_Click(Index As Integer) If Index = 0 Then SendMessage List1.hwnd, WM_VSCROLL, SB_BOTTOM, 0& ElseIf Index = 1 Then SendMessage List1.hwnd, WM_VSCROLL, SB_TOP, 0& ElseIf Index = 2 Then SendMessage List1.hwnd, WM_VSCROLL, SB_PAGEUP, 0& ElseIf Index = 3 Then SendMessage List1.hwnd, WM_VSCROLL, SB_PAGEDOWN, 0& ElseIf Index = 4 Then SendMessage List1.hwnd, WM_VSCROLL, SB_LINEUP, 0& ElseIf Index = 5 Then SendMessage List1.hwnd, WM_VSCROLL, SB_LINEDOWN, 0& End If End Sub Private Sub Form_Load() Command1.Caption = "neue Einträge hinzufügen" Command2(0).Caption = "Ende" Command2(1).Caption = "Anfang" Command2(2).Caption = "PageUp" Command2(3).Caption = "PageDown" Command2(4).Caption = "LineUp" Command2(5).Caption = "LineDown" End Sub |
Jabaco Source |
|
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 |
Option Explicit Private Sub Command1_Click() Dim i As Long 'If Index = 0 Then For i = List1.ListCount To List1.ListCount + 14 List1.AddItem "neuer eintrag " & i Next i 'End If End Sub Private Sub Command2_Click(Index As Integer) Dim vp As javax#swing#JViewport = List1.getViewport Dim CellHeight As Integer Dim MaxYPos = vp.getViewSize.getHeight-vp.getViewRect.getHeight If Index = 0 Then 'List1.ListIndex = List1.ListCount-1 vp.setViewPosition(New Point(0,MaxYPos)) ElseIf Index = 1 Then 'List1.ListIndex = 0 vp.setViewPosition(New Point(0,0)) ElseIf Index = 2 Then If vp.getViewPosition.y-vp.getViewRect.getHeight > 0 Then vp.setViewPosition(New Point(0,(vp.getViewPosition.y-vp.getViewRect.getHeight))) Else vp.setViewPosition(New Point(0,0)) End If ElseIf Index = 3 Then If vp.getViewPosition.y-vp.getViewRect.getHeight < MaxYPos Then vp.setViewPosition(New Point(0,(vp.getViewPosition.y+vp.getViewRect.getHeight))) Else vp.setViewPosition(New Point(0,MaxYPos)) End If ElseIf Index = 4 Then If vp.getViewSize.getHeight > vp.getViewRect.getHeight Then CellHeight = vp.getViewSize.getHeight / List1.ListCount If vp.getViewPosition.y-CellHeight > 0 Then vp.setViewPosition(New Point(0,(vp.getViewPosition.y-CellHeight))) Else vp.setViewPosition(New Point(0,0)) End If End If ElseIf Index = 5 Then If vp.getViewSize.getHeight > vp.getViewRect.getHeight Then CellHeight = vp.getViewSize.getHeight / List1.ListCount If vp.getViewPosition.y-CellHeight < MaxYPos Then vp.setViewPosition(New Point(0,(vp.getViewPosition.y+CellHeight))) Else vp.setViewPosition(New Point(0,MaxYPos)) End If End If End If List1.setViewport(vp) End Sub Private Sub Form_Load() Command1.Caption = "neue Einträge hinzufügen" Command2(0).Caption = "Ende" Command2(1).Caption = "Anfang" Command2(2).Caption = "PageUp" Command2(3).Caption = "PageDown" Command2(4).Caption = "LineUp" Command2(5).Caption = "LineDown" End Sub |
Jabaco Source |
|
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 |
Public Sub Command1_Click(Index As Integer) Select Case Index Case 0 'move first List1.Parent.getSelectionModel().setSelectionInterval(0, 0) List1.ensureIndexIsVisible(0) Case 1 'first visible List1.Parent.getSelectionModel().setSelectionInterval(0, List1.getFirstVisibleIndex) List1.ensureIndexIsVisible(List1.getFirstVisibleIndex) Case 2 'move previous If List1.Selected(0) Then Exit Sub List1.Parent.getSelectionModel().setSelectionInterval(0, List1.ListIndex - 1) List1.ensureIndexIsVisible(List1.ListIndex - 1) Case 3 'move next If List1.Selected(List1.ListCount - 1) Then Exit Sub List1.Parent.getSelectionModel().setSelectionInterval(0, List1.ListIndex + 1) List1.ensureIndexIsVisible(List1.ListIndex + 1) Case 4 'last visible List1.Parent.getSelectionModel().setSelectionInterval(0, List1.Parent.getLastVisibleIndex) List1.ensureIndexIsVisible(List1.Parent.getLastVisibleIndex) Case 5 'move last List1.Parent.getSelectionModel().setSelectionInterval(0, List1.ListCount - 1) List1.ensureIndexIsVisible(List1.ListCount - 1) End Select End Sub |
This post has been edited 2 times, last edit by "Dani" (Feb 1st 2013, 11:14am)