|
-
Jun 11th, 2000, 09:30 AM
#1
Thread Starter
Addicted Member
Hi there,
I have a ListBox with > 100 items, at the same time I have a Frame which has multible CheckBoxes. The Q is:
How can I make the frame move up/down with whichever is selected from the listbox ??
I have this code:
Code:
Private Sub Form_Load()
Frame1.Left = List1.Left + List1.Width
Frame1.Top = List1.Top - 180
End sub
Private Sub List1_Click()
Frame1.Top = List1.ListIndex * 300
End Sub
The 2 problems i'm having are:
- The Listindex When it's (0) ??
- When selecting item > 20 , the Frame would be Hidden !?
Thanx for any help.
-
Jun 11th, 2000, 11:01 PM
#2
Thread Starter
Addicted Member
Am I not clear enough !?
If so, please let me know?
Thanx.
-
Jun 12th, 2000, 12:09 AM
#3
transcendental analytic
Unfortnately, yeah, it's a bit hard to picture what you're trying to do.
Do you want scroll the contents of the frame?
You could also make the ckeckboxes in the listbox.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jun 12th, 2000, 02:00 AM
#4
To move only the CheckBoxes, you could set their Tag property to "1" then use a For Each loop to move them.
Code:
Dim MyObj As Object
For Each MyObj In Form1.Controls
If MyObj.Tag = "1" Then
MyObj.Move MyObj.Left + 50
End If
Next MyObj
-
Jun 12th, 2000, 07:03 AM
#5
Thread Starter
Addicted Member
Thanx for replying.
Yes. I want to move/scroll the whole frame with it's contents. 
The ListBox would have Only 20 items visible. When you click item # 3 I want that frame to (move) to be in the same level with the clicked item.
The problem is: If, for example, I click item # 41 , the frame would move way below.
Because, as you can see from the code, it takes the ListIndex * 300
Again, Thanx.
-
Jun 12th, 2000, 07:18 AM
#6
transcendental analytic
Well you could move the content as Meg showed but instead of using the tag property use Getparent api and compare it to the frame hwnd. But i would use a regular listbox, also if you have 300 checkboxes, you won't have much resources and RAM let when you run it.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jun 12th, 2000, 08:07 AM
#7
Thread Starter
Addicted Member
OK, Ok. Let me put it this way.
How can I find the (X,Y) of the selected item in the List1_Click Event ??
Which could be found in List1_MouseDown Event.
Thanx.
-
Jun 12th, 2000, 10:12 AM
#8
transcendental analytic
You could either store x and y from mousedown event since it will fire before click, or use getcursorpos and clienttoscreen api to get the position in pixels
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|