Jump to content

the box _ArrayDisplay() and its apperance


roeselpi
 Share

Recommended Posts

hello,

if i have an array that has for example 100 rows and 3 columns:  

then my monitor will display a box which is as wide as 4 columns whilst the first one being the description of each row

furthermore my monitor will display a maximum of 46 rows.

sure, there is a scrollbar and i can scroll down to see the whole array and that is good.

my question would however be:

 

is there some (simple) way to have the size of the display-box to be a little wider and not so high. something like 6 columns wide and only 15 rows high while still haveing the possibility to scroll down to look at the whole array?

 

i have see a few topics about the _ArrayDisply modification, but i was kind of looking for a simple way to do it. maybe placing the _ArrayDisplay() into a child window that has a specific size or something like that. any chance to find a simple solution for that? something easy and sweet:

 

$width = "6"

$height = "15"

_Arraydisplay($name, "Text to be displayed", $width, $height)

 

something as simple as that.

 

any ideas?

kind regards

 

 

Link to comment
Share on other sites

Don't use arraydisplay, build your own gui with a listview in it, and you can configure it however you'd like

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

that seems to be quite frustrating:

#include <Array.au3>
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>


Global $values[20][2] = [["r0-c1", "r0-c2"], ["r1-c1", "r1-c2"], ["r2-c1", "r2-c2"], ["r3-c1", "r3-c2"], ["r4-c1", "r4-c2"], _
        ["r5-c1", "r5-c2"], ["r6-c1", "r6-c2"], ["r7-c1", "r7-c2"], ["r8-c1", "r8-c2"], ["r9-c1", "r9-c2"], _
        ["r10-c1", "r10-c2"], ["r11-c1", "r11-c2"], ["r12-c1", "r12-c2"], ["r13-c1", "r13-c2"], ["r14-c1", "r14-c2"], _
        ["r15-c1", "r15-c2"], ["r16-c1", "r16-c2"], ["r17-c1", "r17-c2"], ["r18-c1", "r18-c2"], ["r19-c1", "r19-c2"]]

_ArrayDisplay($values) ;This is perfect, only the size of the window bothers me


GUICreate("ListView Display Array", 500, 300)
$idListview = GUICtrlCreateListView("", 2, 2, 494, 268)
GUISetState(@SW_SHOW)
_GUICtrlListView_AddColumn($idListview, "Rows", 100)
_GUICtrlListView_AddColumn($idListview, "Column 1", 100)
_GUICtrlListView_AddColumn($idListview, "Column 2", 100)

_GUICtrlListView_AddArray($idListview, $values) ;This is nice but wrong. it does not resemble the _ArrayDisplay()

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()

while the _ArrayDisplay() is one line and looks great, the listview requires lots of lines and in my case does not do what it should (which, no doubt, is probably my fault). however it is not a nice little one liner to get the job done but rather more a code that frurstrates because not used properly it does not do the job it is supposed to.

i guess i would rather live with the oversized window of the _ArrayDisplay() than start messing about with a multilined code that takes the long way round to do the job it is supposed to.

unless:

anyone has a foolproof & easy solution possibly something like this imaginary line:

_GUICtrlListView_AddArray($values, 500, 300)

why make something simple so complicated? 

Link to comment
Share on other sites

Why are you so lazy?

#include <Array.au3>
#include <Debug.au3>

Global $values[20][2] = [["r0-c1", "r0-c2"], ["r1-c1", "r1-c2"], ["r2-c1", "r2-c2"], ["r3-c1", "r3-c2"], ["r4-c1", "r4-c2"], _
        ["r5-c1", "r5-c2"], ["r6-c1", "r6-c2"], ["r7-c1", "r7-c2"], ["r8-c1", "r8-c2"], ["r9-c1", "r9-c2"], _
        ["r10-c1", "r10-c2"], ["r11-c1", "r11-c2"], ["r12-c1", "r12-c2"], ["r13-c1", "r13-c2"], ["r14-c1", "r14-c2"], _
        ["r15-c1", "r15-c2"], ["r16-c1", "r16-c2"], ["r17-c1", "r17-c2"], ["r18-c1", "r18-c2"], ["r19-c1", "r19-c2"]]

_ArrayDisplay($values, "Title of your choice")                          ;This is perfect, only the size of the window bothers me
_ArrayDisplay(_ArrayExtract($values, 0, 6), "Title of your choice"))    ; is that any better?
_DebugArrayDisplay($values, "Title of your choice", "0:6")              ; or do you prefer this?

 

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Ok if I understand you correctly you would like to have larger column size, right ?  Simply do this :

Local Const $nPad = 40
$values [0][0] &= _StringRepeat (" ",$nPad)
$values [0][1] &= _StringRepeat (" ",$nPad)
_ArrayDisplay ($values, "Miracles can happen...")

:lol:

Link to comment
Share on other sites

Quote

_GUICtrlListView_AddArray($idListview, $values) ;This is nice but wrong. it does not resemble the _ArrayDisplay()
 

What is wrong with the display of the array in this example, what's missing from it that _arrayDisplay shows that this one doesn't, other than the row numbers?

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

hi,

@jchd Quote: "Why are you so lazy?" Reply: it has nothing to do with being lazy! it just has something to do with keeping everything short and simple and i just fail to see the point that i should write many lines of code, that are predestined for errors creeping in here and there instead of just writing one line where the margin of error is drastically reduced. being a programmer yourself, you will have to admit, that going trough 10 or more lines of text instead of 1 line to look for an error must be easier and less time consuming. 

besides that: 

_ArrayDisplay(_ArrayExtract($values, 0, 6), "Title of your choice")) ; is that any better?

is not better because i can not scroll down anymore. i had tried something like that already with the normal _ArrayDisplay() but it just limits it to the specified amount of rows and does not show the ones below at all.

_DebugArrayDisplay($values, "Title of your choice", "0:6")           ; or do you prefer this?

the debug one does not work at all for some reason, but i guess it would not look much different than the first example.

 

---

 

@Nine width = super. that is great. height on the other hand with larger arrays still the same thing. window allmost as high as the screen and that is what i was trying to define as well as the width. but it is a lot better from the width and that is a great start.

 

---

@BrewManNH Quote: "What is wrong with the display of the array in this example [ ... ] other than the row numbers? Reply: exactly. the row numbers are missing. so it does not look like the _ArrayDisplay() just more width and less height.

 

---

 

i guess you might be thinking "this guy is a bit stupid and the things he wants are things not many people pay attention to", sure, that all might be true but like mentioned above in my mind a code should be short because the less code, the smaller the size and the less mistakes are in the code. there is many things missing in the autoIT universe where i would say that would be great if it had that. another great example would be the MsgBox() a test can not really be formated within the message box. no italic, no bold, no center text, no justify text, etc.

it might all be great once you know how to write code and once you know how to workarround problems like that and i am sure that a listview has more possibilities than a simple array display but sometimes a simple display will suffice and it would just be that little bit nicer if you could tweak it a little to make it even nicer.

 

as i say, i am no programmer, i am just someone who would like to learn how to do this and i would like to be able to design it the way i envision it best of all with little margin of error (or as i would call it: less code). 

Link to comment
Share on other sites

  • Moderators

roeselpi,

Quote

another great example would be the MsgBox() a test can not really be formated within the message box. no italic, no bold, no center text, no justify text, etc.

Take a look at my ExtMsgBox UDF (the link is in my sig) which allows you to do all that - and more.....

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

  • Moderators

roselpi,

Having now read back a bit more in the thread, I feel I must comment on this phrase from your last post:

Quote

it has nothing to do with being lazy! it  just has something to do with keeping everything short and simple and i just fail to see the point that i should write many lines of code, that are predestined for errors creeping in here and there instead of just writing one line

I am afraid that I do not agree with you here. You cannot expect AutoIt to provide functions that do exactly as you expect/wish in every case - it gives you a good set of basic commands which allow you to do practically anything with a bit of imagination and hard work. The UDFs we include with the standard AutoIt install are a good example of that - as the main author of the current _ArrayDisplay code I can assure you that its present behaviour is the result of many requests for an auto-expanding dialog, rather then the old fixed size one that used to be offered. My personal ExtMsgBox UDF that I suggested to you above is another case where basic AutoIt commands are combined to give you something much more polished than the basic Windows dialog.

So what you are actually asking is for someone else to do all the hard work so that you can write a simple one-line command in your script which produces exactly what you require. Well, if that is not lazy - then I do not know what is!

However, you finish with this line:

Quote

i am just someone who would like to learn how to do this and i would like to be able to design it the way i envision it best of all with little margin of error (or as i would call it: less code). 

And this is exactly what I would recommend. Take the existing _ArrayDisplay code (you actually need to look at ArrayDisplayInternals.au3) and try to understand what is going on within it - the code is actually pretty well commented for a standard UDF which will help enormously. You should then be able to write your version, omitting or changing various sections to get precisely what you want. I am certain people here will offer help on any questions you might have - as long as you have done due diligence with the Help file and forum search facility beforehand.

That is the best way to learn AutoIt - getting down and dirty with the code.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

22 minutes ago, roeselpi said:

a code should be short because the less code, the smaller the size and the less mistakes are in the code.

Have you looked at the amount of code there is in the _ArrayDisplay function? Just because YOU"RE code only has one line there are over 500 lines of code inside that function and all of the linked functions used to get it to the point it is. You could EASILY code something similar and have it conform to your wishes, you're just asking for it to be spoon fed to you.

Adding a column to an array for the row numbers is trivial and can be done with maybe four lines of code. Try experimenting and see what you can come up with.

26 minutes ago, roeselpi said:

another great example would be the MsgBox()

That's Microsoft's message box, not AutoIt's, it is just a wrapper function to access the built-in Microsoft code. You'd get the same thing in VBScript or any other language that accesses the Windows default MessageBox.

 

28 minutes ago, roeselpi said:

but sometimes a simple display will suffice and it would just be that little bit nicer if you could tweak it a little to make it even nicer.

Sorry, if you want that, build it.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

@roeselpi if you find a few dozens lines of AutoIt code something overhelming (according to your standard) I urge you to download a basic C compiler suite and code the thing you're after in pure C. Remember that C is still today the most prevalent language ever (in running lines of code).

Once you pass the 3500 lines of C you'll find forking AutoIt _ArrayDisplay() to clone and tune it to your needs is a piece of cake.

Hence when I used the word lazy I was right on track.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...