|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Keeping 2 listboxes in sync - VB6Hope I explain this OK! Basically I've got one listbox (incorporating checkboxes) that overlaps another so that the following display is shown: [ ] [ ] Cats [ ] [ ] Dogs [ ] [ ] Horses [ ] [ ] Sheep etc... etc.. The reason for this is so that the user can use the 1st column of checkboxes to include particular people and the 2nd one to exclude them. To try and keep both listboxes in sync when the user uses the top listbox's scrollbar to go up and down I use the following code: Private Sub lsbInitMenuList_Scroll(Index As Integer) lsbInitMenuList(0).TopIndex = lsbInitMenuList(1).TopIndex End Sub Now I originally tested this on 3 x WinXP machines and it works fine, but I've run it on a couple more XP machines and Vista machines and the scrollbar scrolling makes the list go wappie! The underneath listbox doesn't seem to move as the top listbox starts to go down and then the app seems to catch up to put them back into sync. Having tried it on a Vista machine a few minutes go the listboxes do eventually line up again, but the wappie-ness of the entries go up-and-down and out of sync looks pants and unprofessional. Is there anyway I can make this smoother?? Thanks "Mojo" <please@dont.spam.com> wrote in message <cut>news:Odb9WGX$JHA.5092@TK2MSFTNGP03.phx.gbl... > The underneath listbox doesn't seem to move as the top listbox starts to If it were me I'd look at either using a grid control rather than the 2 > go > down and then the app seems to catch up to put them back into sync. > Having > tried it on a Vista machine a few minutes go the listboxes do eventually > line up again, but the wappie-ness of the entries go up-and-down and out > of > sync looks pants and unprofessional. Is there anyway I can make this > smoother?? listboxes or use a listbox that supports images (even a listview) and have 3 images (select, delete, no choice) and toggle through them as the user clicks. Hi Bob
Thanks for your lightning reply. Problem is I want to keep things tight so to complicate matters even more this dual-listbox feature is actually a dropdown dual-listbox. Initial display is a dropdown list with down arrow. User clicks the box or arrow to reveal the dual-listbox. With this I don't think the listview will work as I can only get one checkbox per entry - can you get more? I like the image combo option, but having had a little play you'd have to keep clicking, scrolling and clicking again to change the state of an entry, eg If I want to exclude the 16th entry I'd have to click on the combo to see the list, scrolldown to the 16th entry, select it to change it to the Include pic, combo disappears on the click so I'd have to click the combo again, scroll down to the 16th entry, click on it again to change it to the Exclude pic and then if I want it to go back to no selection I'd have to do all of this process again. Am I way off the mark on how this would work? Rgds "Bob Butler" <noway@nospam.ever> wrote in message <cut>news:OPZMePX$JHA.1376@TK2MSFTNGP02.phx.gbl... "Mojo" <please@dont.spam.com> wrote in message news:Odb9WGX$JHA.5092@TK2MSFTNGP03.phx.gbl... > The underneath listbox doesn't seem to move as the top listbox starts to If it were me I'd look at either using a grid control rather than the 2> go > down and then the app seems to catch up to put them back into sync. > Having > tried it on a Vista machine a few minutes go the listboxes do eventually > line up again, but the wappie-ness of the entries go up-and-down and out > of > sync looks pants and unprofessional. Is there anyway I can make this > smoother?? listboxes or use a listbox that supports images (even a listview) and have 3 images (select, delete, no choice) and toggle through them as the user clicks. "Mojo" <please@dont.spam.com> wrote in message That would have been useful to specify in the original post. I'd probably news:%23a%23usnX$JHA.3544@TK2MSFTNGP04.phx.gbl... > Hi Bob > > Thanks for your lightning reply. > > Problem is I want to keep things tight so to complicate matters even more > this dual-listbox feature is actually a dropdown dual-listbox. Initial > display is a dropdown list with down arrow. User clicks the box or arrow > to > reveal the dual-listbox. consider replacing the combobox with a locked textbox or label or something and when the user clicks on then I'd still display a grid or other control which can then be hidden when the user makes their selection. > With this I don't think the listview will work as I can only get one With a listview I was thinking of having one of 3 icons displayed depending > checkbox per entry - can you get more? on the state of the entry. double-clicking the entry would rotate through the available options and change the icon. That was before you mentioned this being a drop-down list so to do that you'd probably need an alternate way to close the display. A grid control makes more sense to me. I'm sure others will have more options to suggest "Bob Butler" <noway@nospam.ever> wrote I would have done a scrollable viewport setup (2 pictureboxes) and simply> I'm sure others will have more options to suggest draw the checkboxes and text. Its all just so many pixels on the screen, what does the user know who draws them??? LFS
Show quote
Hide quote
"Mojo" <please@dont.spam.com> wrote in message Maybe I'm just not understanding something, but why have 2 boxes at all? news:Odb9WGX$JHA.5092@TK2MSFTNGP03.phx.gbl... > Hi All > > Hope I explain this OK! > > Basically I've got one listbox (incorporating checkboxes) that overlaps > another so that the following display is shown: > > [ ] [ ] Cats > [ ] [ ] Dogs > [ ] [ ] Horses > [ ] [ ] Sheep > etc... etc.. > > The reason for this is so that the user can use the 1st column of > checkboxes > to include particular people and the 2nd one to exclude them. Why won't just one work? Any that are checked are included. Any that are not checked are excluded. I don't see why you need a box that's specific for exclusion. -- Mike On 05/07/2009 19:13, MikeD wrote:
Show quoteHide quote > This has been discussed before, and what you propose is not the same thing.> "Mojo" <please@dont.spam.com> wrote in message > news:Odb9WGX$JHA.5092@TK2MSFTNGP03.phx.gbl... >> Hi All >> >> Hope I explain this OK! >> >> Basically I've got one listbox (incorporating checkboxes) that overlaps >> another so that the following display is shown: >> >> [ ] [ ] Cats >> [ ] [ ] Dogs >> [ ] [ ] Horses >> [ ] [ ] Sheep >> etc... etc.. >> >> The reason for this is so that the user can use the 1st column of >> checkboxes >> to include particular people and the 2nd one to exclude them. > > > Maybe I'm just not understanding something, but why have 2 boxes at all? > Why won't just one work? Any that are checked are included. Any that are > not checked are excluded. I don't see why you need a box that's specific > for exclusion. Admittedly, with the sample values given, that is not clear... :) -- Dee Earley (dee.ear***@icode.co.uk) i-Catcher Development Team iCode Systems "Mojo" <please@dont.spam.com> wrote With a minimal effort you can do the work yourself. To see what I mean, add> The underneath listbox doesn't seem to move as the top listbox starts to go > down and then the app seems to catch up to put them back into sync. Having > tried it on a Vista machine a few minutes go the listboxes do eventually > line up again, but the wappie-ness of the entries go up-and-down and out of > sync looks pants and unprofessional. Is there anyway I can make this > smoother?? a Picturebox to a new form and place a VScroll bar inside the picturebox (so the picturebox contains the scrollbar). Set the picturebox Appearance property to 0 - Flat, then paste in the code below and see one possibility.... LFS Option Explicit Private Items, Values, TopIndex Private Sub Form_Load() Picture1.Move 300, 300, 2400, 2010 Picture1.AutoRedraw = True Picture1.BackColor = vbWhite Items = Array("Apple", "Banana", "Cherry", "Fig", "Grape", "Mango", _ "Pear", "Raspberry", "Strawberry", "Watermelon") Values = Array(1, -1, 0, 0, 0, 0, 0, 0, 0, 0) VScroll1.Min = 0 VScroll1.Max = 3 VScroll1.Value = 0 VScroll1.Move 2165, 0, 255, 1990 Picture1.Font.Size = 10 DrawList End Sub Private Sub DrawList() Dim i, Y Picture1.Cls Picture1.Font.Name = "MS Sans Serif" Picture1.Font.Bold = True Picture1.Print " INC EXC ITEM" Y = 240 For i = TopIndex To TopIndex + 6 LineItem i, Y Y = Y + 240 Next End Sub Sub LineItem(idx, pos) Debug.Print idx, pos, Items(idx) Picture1.Line (120, pos)-Step(240, 240), vbBlack, B Picture1.Line (660, pos)-Step(240, 240), vbBlack, B Picture1.Font.Name = "MS Sans Serif" Picture1.Font.Bold = False Picture1.PSet (1110, pos), vbWhite Picture1.Print Items(idx) If Values(idx) <> 0 Then Picture1.Font.Name = "Marlett" Picture1.Font.Bold = False Picture1.PSet (Values(idx) * -270 + 425, pos + 30) Picture1.Print "b" End If End Sub Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) Dim yy yy = Y \ 240 If yy > 0 And yy < 8 Then OnClick X, yy - 1 + TopIndex End If End Sub Sub OnClick(X, Y) If X > 120 And X < 360 Then If Values(Y) <= 0 Then Values(Y) = 1 Else Values(Y) = 0 End If ElseIf X > 660 And X < 900 Then If Values(Y) >= 0 Then Values(Y) = -1 Else Values(Y) = 0 End If End If DrawList End Sub Private Sub VScroll1_Change() TopIndex = VScroll1 DrawList End Sub Private Sub VScroll1_GotFocus() Picture1.SetFocus End Sub Private Sub VScroll1_Scroll() TopIndex = VScroll1 DrawList End Sub
Show quote
Hide quote
> Basically I've got one listbox (incorporating checkboxes) that Maybe this might help you:> overlaps > another so that the following display is shown: > > [ ] [ ] Cats > [ ] [ ] Dogs > [ ] [ ] Horses > [ ] [ ] Sheep > etc... etc.. > > The reason for this is so that the user can use the 1st column of > checkboxes > to include particular people and the 2nd one to exclude them. > > To try and keep both listboxes in sync when the user uses the top > listbox's > scrollbar to go up and down I use the following code: > > Private Sub lsbInitMenuList_Scroll(Index As Integer) > lsbInitMenuList(0).TopIndex = lsbInitMenuList(1).TopIndex > End Sub > > Now I originally tested this on 3 x WinXP machines and it works fine, > but > I've run it on a couple more XP machines and Vista machines and the > scrollbar scrolling makes the list go wappie! > > The underneath listbox doesn't seem to move as the top listbox starts > to go > down and then the app seems to catch up to put them back into sync. > Having > tried it on a Vista machine a few minutes go the listboxes do > eventually > line up again, but the wappie-ness of the entries go up-and-down and > out of > sync looks pants and unprofessional. Is there anyway I can make this > smoother?? http://www.aboutvb.de/khw/artikel/khwcontrolsync.htm Regards Harald M. Genauck "VISUAL STUDIO one" - http://www.visualstudio1.de "ABOUT Visual Basic" - http://www.aboutvb.de
VB Express and VB files
Is my VB6 app form open? Vista 64 and Visual Studio 6 Re: ADO: Deleting a table after it is loaded into Recordset ListBox - Limit Selection Rectangle Width In-Process and Out-of-Process Exporting a function from VB.net DLL Need help retrieving a udp response after sending a udp command Re: Problem using PictureBox_Resize event instead of subclassing Control Snap Problem |
|||||||||||||||||||||||