Horizontal scrolling list ctrl?
Jeff Wishnie -- jwishnie@swellsoft.com Tuesday, May 07, 1996 Config: Win95 VisC++/MFC 4.1 For my App's gui I would like a single horizontal row of 32x32 icons that scrolls horizontally. like: ---------------------------------------- | ----- ----- ----- ----- | | | | | | | | | | | | | | | | | | | | | | ----- ----- ----- ----- | ---------------------------------------- | < "scroll bar" > | ---------------------------------------- I'm using a CListCtrl to achieve this. Using the following create flags I get _most_ of the behavior I want: LVS_ALIGNTOP | LVS_AUTOARRANGE | LVS_ICON Align top makes them all go in a horizontal row at the top of the view, auto-arrange keeps them neat, and Icon puts the control in icon mode. BUT there is _no_ horizontal scroll bar and the default behavior when the control is sized smaller than it's contents is to show a _vertical_ scrollbar (ugh) I can't seem to find the appropriate settings to tell it to use a horizontal one instead. Has anyone done this? Is it possible or do I have to do something nasty like set it no-scroll and embed it in a scrollview I can control directly? Thanks! - jeff jwishnie@swellsoft.com 415 552-3125(w)
R.H.J. Geraets -- R.Geraets@Ehv.Tass.Philips.Com Friday, May 10, 1996 [Mini-digest: 2 responses] At 21:21 5/7/96 -0700, you wrote: >Config: Win95 VisC++/MFC 4.1 > >For my App's gui I would like a single horizontal row of 32x32 icons that >scrolls horizontally. > [...] >I'm using a CListCtrl to achieve this. Using the following create flags I get >_most_ of the behavior I want: > >LVS_ALIGNTOP | LVS_AUTOARRANGE | LVS_ICON > >Align top makes them all go in a horizontal row at the top of the view, >auto-arrange keeps them neat, and Icon puts the control in icon mode. > >BUT there is _no_ horizontal scroll bar and the default behavior when the >control is sized smaller than it's contents is to show a _vertical_ >scrollbar (ugh) > [...] Using LVS_ALIGNLEFT in stead of LVS_ALIGNTOP should do the trick. Make sure your ListCtrl is just high enough to hold one row of icons. explanation: When adding items with AlignTop, new icons are added along the top untill the row is full, and then proceeds with a new row ( -> growing vertically -> vertical scrollbar) When adding items with AlignLeft, new icons are added along the left side untill the column is full, and then proceed with a new column ( -> growing horizontally -> horizontal scrollbar) By making your control just one icon high, you get the row you want. Rene' Geraets --- R.H.J. Geraets Vonderweg 11 E-mail: Philips TASS PO-box 218/Geb. HCZ-1 R.Geraets@ehv.tass.philips.com MMA Department 5600 MD Eindhoven Phone: (+31) 40-2758341 Building HCZ-158 The Netherlands Fax: (+31) 40-2755419 --- -----From: jhewett@ix.netcom.com (Jerry Hewett) Check out Example 06B from _Inside Visual C++ Version 4_, by David Kruglinski; his scrolling CList in the dialog resource is *exactly* what you're after. The .RC code looks like this: CONTROL "List1",IDC_LISTVIEW1,"SysListView32",LVS_LIST | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,220,12,120,24, WS_EX_LEFTSCROLLBAR >From within MS Developer Studio you can edit the List control and make the following changes: List Control Properties General == Visible and Tabstop checked Styles == View: List, Align: Left, Sort: None, Border is checked Extended == Left Scroll Bar is checked Hope this helps! Jerry H.
| Вернуться в корень Архива |