Jump to content
Sign in to follow this  
Killer

scrollbar hassle

Recommended Posts

I would like to have a scrollbar that goes up down in the attached code. Can anyone help me?

#include <GUIConstants.au3>

GUICreate("listview items",220,250, 100,200,-1,$WS_EX_ACCEPTFILES)

GUISetBkColor (0x00E0FFFF) ; will change background color

$listview = GuiCtrlCreateListView ("col1 |col2|col3 ",10,10,200,150,$LVS_LIST)

$button = GuiCtrlCreateButton ("Value?",75,170,70,20)

$item1=GuiCtrlCreateListViewItem("item2|col22|col23",$listview)

$item2=GuiCtrlCreateListViewItem("............item1|col12|col13",$listview)

$item3=GuiCtrlCreateListViewItem("item3|col32",$listview)

$item4=GuiCtrlCreateListViewItem("item44443",$listview)

$item5=GuiCtrlCreateListViewItem("item2|col22|col23",$listview)

$item6=GuiCtrlCreateListViewItem("............item1|col12|col13",$listview)

$item7=GuiCtrlCreateListViewItem("item3|col32",$listview)

$item8=GuiCtrlCreateListViewItem("item44443",$listview)

$item9=GuiCtrlCreateListViewItem("item2|col22|col23",$listview)

$item10=GuiCtrlCreateListViewItem("............item1|col12|col13",$listview)

$item11=GuiCtrlCreateListViewItem("item3|col32",$listview)

$item12=GuiCtrlCreateListViewItem("item44443",$listview)

$item13=GuiCtrlCreateListViewItem("............item1|col12|col13",$listview)

$item14=GuiCtrlCreateListViewItem("item3|col32",$listview)

$item15=GuiCtrlCreateListViewItem("item44443",$listview)

$item16=GuiCtrlCreateListViewItem("............item1|col12|col13",$listview)

$item17=GuiCtrlCreateListViewItem("item3|col32",$listview)

$item18=GuiCtrlCreateListViewItem("item44443",$listview)

GuiCtrlCreateInput("",20,200, 150)

GuiCtrlSetState(-1,$GUI_DROPACCEPTED) ; to allow drag and dropping

GuiSetState()

Do

$msg = GuiGetMsg ()

Select

Case $msg = $button

MsgBox(0,"listview item",GUICtrlRead(GUICtrlRead($listview)),2)

Case $msg = $listview

MsgBox(0,"listview", "clicked="& GuiCtrlGetState($listview),2)

EndSelect

Until $msg = $GUI_EVENT_CLOSE

Share this post


Link to post
Share on other sites

Now it has a scroll bar

#include <GUIConstants.au3>

GUICreate("listview items",220,250, 100,200,-1,$WS_EX_ACCEPTFILES)
GUISetBkColor (0x00E0FFFF); will change background color

$listview = GuiCtrlCreateListView ("col1 |col2|col3 ",10,10,200,150,$WS_HSCROLL)
$button = GuiCtrlCreateButton ("Value?",75,170,70,20)
$item1=GuiCtrlCreateListViewItem("item2|col22|col23",$listview)
$item2=GuiCtrlCreateListViewItem("............item1|col12|col13",$listview)
$item3=GuiCtrlCreateListViewItem("item3|col32",$listview)
$item4=GuiCtrlCreateListViewItem("item44443",$listview)
$item5=GuiCtrlCreateListViewItem("item2|col22|col23",$listview)
$item6=GuiCtrlCreateListViewItem("............item1|col12|col13",$listview)
$item7=GuiCtrlCreateListViewItem("item3|col32",$listview)
$item8=GuiCtrlCreateListViewItem("item44443",$listview)
$item9=GuiCtrlCreateListViewItem("item2|col22|col23",$listview)
$item10=GuiCtrlCreateListViewItem("............item1|col12|col13",$listview)
$item11=GuiCtrlCreateListViewItem("item3|col32",$listview)
$item12=GuiCtrlCreateListViewItem("item44443",$listview)
$item13=GuiCtrlCreateListViewItem("............item1|col12|col13",$listview)
$item14=GuiCtrlCreateListViewItem("item3|col32",$listview)
$item15=GuiCtrlCreateListViewItem("item44443",$listview)
$item16=GuiCtrlCreateListViewItem("............item1|col12|col13",$listview)
$item17=GuiCtrlCreateListViewItem("item3|col32",$listview)
$item18=GuiCtrlCreateListViewItem("item44443",$listview)
GuiCtrlCreateInput("",20,200, 150)
GuiCtrlSetState(-1,$GUI_DROPACCEPTED); to allow drag and dropping
GuiSetState()

Do
$msg = GuiGetMsg ()

Select
Case $msg = $button
MsgBox(0,"listview item",GUICtrlRead(GUICtrlRead($listview)),2)
Case $msg = $listview
MsgBox(0,"listview", "clicked="& GuiCtrlGetState($listview),2)
EndSelect
Until $msg = $GUI_EVENT_CLOSE

but you need to change column widths



Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

Second attempt

#include <GUIConstants.au3>

GUICreate("listview items",220,250, 100,200,-1,$WS_EX_ACCEPTFILES)
GUISetBkColor (0x00E0FFFF); will change background color

$listview = GuiCtrlCreateListView ("col1 |col2|col3 ",10,10,200,150,BitOR($WS_HSCROLL,$LVS_NOCOLUMNHEADER))
$button = GuiCtrlCreateButton ("Value?",75,170,70,20)
$item1=GuiCtrlCreateListViewItem("item2|col22|col23",$listview)
$item2=GuiCtrlCreateListViewItem("............item1|col12|col13",$listview)
$item3=GuiCtrlCreateListViewItem("item3|col32",$listview)
$item4=GuiCtrlCreateListViewItem("item44443",$listview)
$item5=GuiCtrlCreateListViewItem("item2|col22|col23",$listview)
$item6=GuiCtrlCreateListViewItem("............item1|col12|col13",$listview)
$item7=GuiCtrlCreateListViewItem("item3|col32",$listview)
$item8=GuiCtrlCreateListViewItem("item44443",$listview)
$item9=GuiCtrlCreateListViewItem("item2|col22|col23",$listview)
$item10=GuiCtrlCreateListViewItem("............item1|col12|col13",$listview)
$item11=GuiCtrlCreateListViewItem("item3|col32",$listview)
$item12=GuiCtrlCreateListViewItem("item44443",$listview)
$item13=GuiCtrlCreateListViewItem("............item1|col12|col13",$listview)
$item14=GuiCtrlCreateListViewItem("item3|col32",$listview)
$item15=GuiCtrlCreateListViewItem("item44443",$listview)
$item16=GuiCtrlCreateListViewItem("............item1|col12|col13",$listview)
$item17=GuiCtrlCreateListViewItem("item3|col32",$listview)
$item18=GuiCtrlCreateListViewItem("item44443",$listview)
GuiCtrlCreateInput("",20,200, 150)
GuiCtrlSetState(-1,$GUI_DROPACCEPTED); to allow drag and dropping
GuiSetState()

Do
$msg = GuiGetMsg ()

Select
Case $msg = $button
MsgBox(0,"listview item",GUICtrlRead(GUICtrlRead($listview)),2)
Case $msg = $listview
MsgBox(0,"listview", "clicked="& GuiCtrlGetState($listview),2)
EndSelect
Until $msg = $GUI_EVENT_CLOSE


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

sorry but that is not what I wanted. Sorry I didn't put in clearly but I need to hide the other columns and only shows the first column which I have to use $LVS_LIST. But using $LVS_LIST I will not get a top down scroll bar.

Share this post


Link to post
Share on other sites

sorry but that is not what I wanted. Sorry I didn't put in clearly but I need to hide the other columns and only shows the first column which I have to use $LVS_LIST. But using $LVS_LIST I will not get a top down scroll bar.

This post has been here now for 2 days, and 2 attempts to help you have been made. You know what you want to use $LVS_LIST, but you've only showed one attempt yourself vs. the 2 attempts by BigDod... what else have you tried that hasn't given you the desired results you want?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

What BigDod did was to made changes at this BitOR($WS_HSCROLL,$LVS_NOCOLUMNHEADER)) which is same as just simply $LVS_NOCOLUMNHEADER. The scrollbar will be there by itself. If I include $LVS_LIST the bar will scroll left right instead of the usual top down. I tried adding in other options. I only know simple autoit and unable to do anything advance.

Share this post


Link to post
Share on other sites

Is this what you want

#include <GUIConstants.au3>
#Include <GuiListView.au3>


GUICreate("listview items",220,250, 100,200,-1,$WS_EX_ACCEPTFILES)
GUISetBkColor (0x00E0FFFF); will change background color

$listview = GuiCtrlCreateListView ("col1               |col2|col3 ",10,10,200,150,BitOR($WS_VSCROLL,$LVS_NOCOLUMNHEADER))
$button = GuiCtrlCreateButton ("Value?",75,170,70,20)
$item1=GuiCtrlCreateListViewItem("item2|col22|col23",$listview)
$item2=GuiCtrlCreateListViewItem("............item1|col12|col13",$listview)
$item3=GuiCtrlCreateListViewItem("item3|col32",$listview)
$item4=GuiCtrlCreateListViewItem("item44443",$listview)
$item5=GuiCtrlCreateListViewItem("item2|col22|col23",$listview)
$item6=GuiCtrlCreateListViewItem("............item1|col12|col13",$listview)
$item7=GuiCtrlCreateListViewItem("item3|col32",$listview)
$item8=GuiCtrlCreateListViewItem("item44443",$listview)
$item9=GuiCtrlCreateListViewItem("item2|col22|col23",$listview)
$item10=GuiCtrlCreateListViewItem("............item1|col12|col13",$listview)
$item11=GuiCtrlCreateListViewItem("item3|col32",$listview)
$item12=GuiCtrlCreateListViewItem("item44443",$listview)
$item13=GuiCtrlCreateListViewItem("............item1|col12|col13",$listview)
$item14=GuiCtrlCreateListViewItem("item3|col32",$listview)
$item15=GuiCtrlCreateListViewItem("item44443",$listview)
$item16=GuiCtrlCreateListViewItem("............item1|col12|col13",$listview)
$item17=GuiCtrlCreateListViewItem("item3|col32",$listview)
$item18=GuiCtrlCreateListViewItem("item44443",$listview)
_GUICtrlListViewHideColumn($listview,1)
_GUICtrlListViewHideColumn($listview,2)
GuiCtrlCreateInput("",20,200, 150)
GuiCtrlSetState(-1,$GUI_DROPACCEPTED); to allow drag and dropping
GuiSetState()

Do
$msg = GuiGetMsg ()

Select
Case $msg = $button
MsgBox(0,"listview item",GUICtrlRead(GUICtrlRead($listview)),2)
Case $msg = $listview
MsgBox(0,"listview", "clicked="& GuiCtrlGetState($listview),2)
EndSelect
Until $msg = $GUI_EVENT_CLOSE


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

Changed BitOR($WS_HSCROLL to BitOR($WS_VSCROLL (H for horizontal, V for vertical), those values could have been found in the help file easily under GUI Control Styles, which I assume you've seen to know about $LVS_LIST. Not a bash, but goes with what I said before about trying.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...