Jump to content

[Identified] How to make a proper header in the _ArrayDisplay list view? Parameter transfer issue.


LarsJ
 Share

Recommended Posts

With the $hUser_Function parameter you can show two _ArrayDisplay windows side by side. How do you make a proper header in the _ArrayDisplay list view to the right? The entire header is shown in "Col 0". How do you transfer the header parameter in the proper way through the user function?

I'm running the code directly in SciTE.

#include <Array.au3>
; _ArrayDisplay( $aArray, "ArrayDisplay", "", 0, Default, $sHeader = "", Default, Default, $hUser_Function = 0 )

Global $aArray = [ [ "0/0", "0/1", "0/2", "0/3", "0/4" ], _
                   [ "1/0", "1/1", "1/2", "1/3", "1/4" ], _
                   [ "2/0", "2/1", "2/2", "2/3", "2/4" ], _
                   [ "3/0", "3/1", "3/2", "3/3", "3/4" ], _
                   [ "4/0", "4/1", "4/2", "4/3", "4/4" ], _
                   [ "5/0", "5/1", "5/2", "5/3", "5/4" ], _
                   [ "6/0", "6/1", "6/2", "6/3", "6/4" ], _
                   [ "7/0", "7/1", "7/2", "7/3", "7/4" ], _
                   [ "8/0", "8/1", "8/2", "8/3", "8/4" ], _
                   [ "9/0", "9/1", "9/2", "9/3", "9/4" ] ]

_ArrayDisplay( $aArray, "Click ""Run User Func""", "", 0, Default, "A/0|B/1|C/2|D/3|E/4", Default, Default, UserFunc )

Func UserFunc( $p1, $p2 )
  Local $hWnd = WinGetHandle( "Click ""Run User Func""" )

  Local $aPos = WinGetPos( $hWnd )
  WinMove( $hWnd, "", $aPos[0]-400, $aPos[1] )

  _ArrayDisplay( $aArray, "ArrayDisplay right window (header?)", "", 0, Default, "A/0|B/1|C/2|D/3|E/4" )

  WinClose( $hWnd )
EndFunc

I hope there is someone who can give me the answer before I get to spend the entire weekend on this annoying problem.

Regards Lars.

Edited by LarsJ
window --> list view
Link to comment
Share on other sites

The problem is in the _ArrayDisplay function. When you use "" or Default, the default DataSeparatorChar is reset to "?" instead of "|". When the function ends, it resets it back to "|", but because you're using _ArrayDisplay inside the user function, it jumps out of the function before it's reset back, so the separator character is set to "?" and your _ArrayDisplay doesn't separate the column headers correctly. Even when you specify the separator character, the stringsplit function inside the _ArrayDisplay function is still using "?" as the separator.

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

so just drop the opt in the func?  and $aArray in the func should be $p1, right?

Func UserFunc($p1, $p2)
   Opt("GUIDataSeparatorChar", "|")
  Local $hWnd = WinGetHandle( "Click ""Run User Func""" )
  Local $aPos = WinGetPos( $hWnd )
  WinMove( $hWnd, "", $aPos[0]-400, $aPos[1] )

   _ArrayDisplay($p1, "ArrayDisplay right window (header?)", "", 0, Default, "A/0|B/1|C/2|D/3|E/4" )

  WinClose( $hWnd )
EndFunc

 

Edited by boththose

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

KingBob, Thank you. You are completely right. A solution is to change this line in _ArrayDisplay function:

;Local $sAD_Separator = ChrW(0xFAB1)
Local $sAD_Separator = "|"

 

Link to comment
Share on other sites

Honestly I wonder how that CJK compatibility character found its way as a delimiter.

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

CJK?

Never mind, I looked it up. :)

I hadn't realized that it wasn't actually "?" being used, because my SciTE console window wasn't set to display non-ASCII.

Edited by KingBob

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

Ha, sorry for being cryptic. I just looked up my Unicode SQL table to check that my guess was right. This poor 0xFBA1 character has no use here, there exist a much more sensible ASCII and ANSI and Unicode codepoint well suited for that purpose: unit separator 0x1F even if its primary use was for punched card devices...

Anyway, not resetting the changed separator before invokation of the callback was indeed the culprit.

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

  • Moderators

jchd,

Honestly I wonder how that CJK compatibility character found its way as a delimiter

Because you suggested it! We needed to make sure that you could display whatever character was selected as the current delimiter if it occurred inside the array being displayed, so the actual delimiter needed to be set to something unlikely to be used and you proposed a "user-defined Unicode character" -the specific choice of "0xFAB1" was a personal joke that met the requirements you set.

If you now feel that "0x1F" is more suitable, I will change the UDF accordingly.

M23

Edit: It was discussed in this and subsequent posts.

Edited by Melba23

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

Sorry, memory didn't serve when previously mentionned 0xFBA1 (ARABIC LETTER RNOON FINAL FORM) instead of 0xFAB1 (CJK COMPATIBILITY IDEOGRAPH-FAB1).

Anyway, the private use area in the BMP (basic multilingual plane, the only range we can use since AutoIt use UCS-2 limited to 0x0000..0xFFFF) is 0xE000..0xF8FF.

If I indeed suggested 0xFAB1 then it must be because I was out of myself at that time, I plead guilty for that and beg all the pardon I can get, if any. (I've since stopped mayonnaise injections.)  Note that it's still pretty unlikely that anyone would be seriously affected after all.

What can be inconvenient about a control character like 0x1E (RECORD SEPARATOR) or 0x1F (UNIT SEPARATOR) is that it may not be visible if misused:

MsgBox(0, "", "abc" & Chr(0x1F) & "def" & ChrW(0xEDDA) & "ghi")

 

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

I don't remember which line works, but put both in user properties:

code.page=65001
output.code.page=65001

 

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

Melba23, If you are going to update the code, you should reset the original separator character before the user function is called, and set it again when the user function returns. This would solve the issue in first post.

This has the advantage that when the code in the user function is being executed, it's executed in the user's original AutoIt environment. And not with a special separator character which the user is not aware of.

Lars.

Edited by LarsJ
Link to comment
Share on other sites

  • Moderators

LarsJ,

I was already intending to do just that.

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

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...