Sign in to follow this  
Followers 0
FinalVersion

Couple Simple Questions

8 posts in this topic

1. How can I have multiple Styles or ExStyles? I've tried this.

GUICtrlCreateListView("Process Name|Process ID (PID)", 8, 8, 362, 382, ($style1, $style2))

It appears it didn't work.

2. How can I make columns in ListView's automatically adjust to the largest size text in the column?

3. Is it possible for a ListView to update in realtime? And how would I go about it?

Share this post


Link to post
Share on other sites



FinalVersion,

Having a busy day, aren't we! :mellow:

multiple Styles or ExStyles

You use BitOR like this:

BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU)

A couple of points:

1. Do not use simple addition - although it might work in some cases, Windows often uses the bits as markers and addition can set bits you do not want - then you take ages working out why you have not got what you think you should have (speaking from personal experience here!)

2. When you ever specify a style setting, you overwrite all the previously set styles. If you wish to retain them you must add them back in as well. A common example: the default styles for a ListBox are $LBS_SORT, $WS_BORDER, $WS_VSCROLL; if the $LBS_NOTIFY style is used on its own when the ListBox is created, it overwrites these and the user wonders why the ListBox no longer sorts and has no scrollbar! You have to BitOR the lot (although there is a shorthand way of defining the default styles for most controls - look in the Help file)

2a. You can retrieve the current style setting via an API call and use BitOR again, but we will leave that for another day....

make columns in ListView's automatically adjust to the largest size text

Use _GUICtrlListView_SetColumnWidth with $LVSCW_AUTOSIZE in the $iWidth parameter. Look in the Help file for more details.

Is it possible for a ListView to update in realtime

No, you have to update the ListViewItems in a loop.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Indeed it is a big day. Can you give me an example of multiple styles & exstyles, thanks.

Hey, look in the help. GuiCreate is one but there are loads.

EDIT: and since you have been told the answer, what on earth prevents you from just tring it? All you have to do is put BitOr around the style you used in your first post.

Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

FinalVersion,

Does Sir want fries with that? :(

Run this 3 times using the relevant creation line each time:

#include <GUIConstantsEx.au3>
#include <ListboxConstants.au3>

$hGUI = GUICreate("Test", 500, 500)

$hList = GUICtrlCreateList("", 10, 10, 250, 100) ; run this one first
;$hList = GUICtrlCreateList("", 10, 10, 250, 100, $LBS_NOTIFY) ; run this one second
;$hList = GUICtrlCreateList("", 10, 10, 250, 100, BitOR($GUI_SS_DEFAULT_LIST , $LBS_NOTIFY)) ; run this one third

GUICtrlSetData($hList, "1|2|6|4|7|3|5|8|9") ; unsorted list

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch

WEnd

First run will give you a sorted list with a scroll bar.

Second run will give you an unsorted list and no scroll bar - you have overwritten the default styles by specifying $LBS_NOTIFY.

Third run gives you a sorted list and a scroll bar.

Clear? :mellow:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

I tried this, but it fails.

$lstProcesses = GUICtrlCreateListView("Process Name|Process ID (PID)", 8, 8, 362, 382 BitOR($LBS_SORT, $WS_BORDER, $WS_VSCROLL,$LVS_SINGLESEL, $LVS_SORTASCENDING))

ERROR: GUICtrlCreateListView() [built-in] called with wrong number of args.

I know the error says BitOR has to many parameters. I given it 5, you showed me 4, I believe max is 3. How do I fix this?

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Ah didn't see your second post, anyway I tried your 3rd example, and AutoIt thinks $GUI_SS_DEFAULT_LIST and $LBS_NOTIFY are variables.

I got it working with just "$LVS_SORTASCENDING" and without using BitOR, for the moment it appears to do what I want.

Edited by FinalVersion

Share this post


Link to post
Share on other sites

I tried this, but it fails.

$lstProcesses = GUICtrlCreateListView("Process Name|Process ID (PID)", 8, 8, 362, 382 BitOR($LBS_SORT, $WS_BORDER, $WS_VSCROLL,$LVS_SINGLESEL, $LVS_SORTASCENDING))

ERROR: GUICtrlCreateListView() [built-in] called with wrong number of args.

I know the error says BitOR has to many parameters. I given it 5, you showed me 4, I believe max is 3. How do I fix this?

up to 255 values can be specified to BitOR

The error is a missing comma between the number 382 and BitOR.


GDIPlusDispose - A modified version of GDIPlus that auto disposes of its own objects before shutdown of the Dll using the same function Syntax as the original.EzMySql UDF - Use MySql Databases with autoit with syntax similar to SQLite UDF.

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  
Followers 0