Jump to content
Sign in to follow this  
Jack023

7D Array

Recommended Posts

Jack023

Hello all,

I'm making a Application,

7lfpb.png

Currently it looks like this,

_ArrayAdd($adate, $date)
        _ArrayAdd($arequest, $totalreq)
        _ArrayAdd($aimpressions, $totalimpes)
        _ArrayAdd($aclicks, $total_clicks)
        _ArrayAdd($actr, $ctr)
        _ArrayAdd($acpm, $ecpm)
        _ArrayAdd($aearnings, $totalbalance)

In $adate i have the 4 dates and in $arequest i have the 4 request etc.
Now what i want is that when i click on Impressions that the most highest impression number will be on top and the most owest impression number on the bottom, but ofcourse i want keep the dates correct and that not only the impressions change.

How could i do this?

I though about a 7d array to put every date with their own statistics in the array but found out that this isn't possible.

Any other way to solve this?

Share this post


Link to post
Share on other sites
jdelaney

You would just need 2 dims.

$array[$iCountRows][$iCountDataElementsPerRow]

Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites
Jack023

Then my plan still not works right?

Share this post


Link to post
Share on other sites
BrewManNH

You said you wanted to click on Impressions and sort it by that, this has absolutely nothing to do with arrays or how many dimensions the array has. You're talking about a listview aren't you?

Edited by BrewManNH

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

Share this post


Link to post
Share on other sites
Jack023

Well maybe, in my current application i just use labels what i change with guictrlsetdata, and with arrays i can sort them.

I tried the listview but when i click on top it won't sort from higher to lower:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
    Local $listview, $button, $item1, $item2, $item3, $msg

    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_SORTDESCENDING)
    $button = GUICtrlCreateButton("Value?", 75, 170, 70, 20)
    $item1 = GUICtrlCreateListViewItem("item2|5|42", $listview)
    $item2 = GUICtrlCreateListViewItem("item1|2|3", $listview)
    $item3 = GUICtrlCreateListViewItem("item3|32|33", $listview)
    GUICtrlCreateInput("", 20, 200, 150)
    GUICtrlSetState(-1, $GUI_DROPACCEPTED) ; to allow drag and dropping
    GUISetState(@SW_SHOW)


    ; Loop until the user exits.
    Do
        $msg = GUIGetMsg()

        Select
            Case $msg = $button
                MsgBox($MB_SYSTEMMODAL, "listview item", GUICtrlRead(GUICtrlRead($listview)), 2)
            Case $msg = $listview
                MsgBox($MB_SYSTEMMODAL, "listview", "clicked=" & GUICtrlGetState($listview), 2)
        EndSelect
    Until $msg = $GUI_EVENT_CLOSE
EndFunc   ;==>Example

Share this post


Link to post
Share on other sites
BrewManNH

First of all, remove the autosort style setting from the listview when you create it. Second, there are functions that will sort the Listview when you click the headers. There are dozens of examples on the forum as to how to do 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

Share this post


Link to post
Share on other sites
Jack023

Alright, Checked it out and i can make it in a guicreate listview, but how to place it in my current gui like the picture in the 1st post?

Share this post


Link to post
Share on other sites
FireFox

The helpfile example is not enough? What have you tried so far?


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
Jack023

Alright, got it working for so far,

Ofcourse there are always new problems..

7mdrv.png

I changed the background color with: 

Global $listview = GUICtrlCreateListView("Date               |Requests           |Impressions                                |Clicks           |CTR          |eCPM           |Earnings               ", 15, 160, 685, 105)


  GUICtrlSetBkColor($listview, 0xF0F6F7)

Code looks better in my autoit but anyway,
Few things i don't like is the white line under the listview and on the right side of the listview.

Then i want to remove that i can make the tabs smaller or bigger, i want just 1 size and not able to make them smaller or bigger.

Is this possible?

Then i want to make it sortable,

It's clickable right now but i want like if i click earnings then the top earnings will be on top etc.

EDIT:

found out i can use this code so i cant resize the columns:

ControlDisable($hGUI, "", HWnd(_GUICtrlListView_GetHeader($hListView)))

only the problem is that i can't click it anymore to sort it in the future..

Edited by Jack023

Share this post


Link to post
Share on other sites
Jack023

I tried to fix the white line with:

GUICtrlSetBkColor($listview, 0xF2F6F7)

    _GUICtrlListView_SetBkColor($listview, 0xF2F6F7)

For some reason this don't work and nothing change,

But if i use this: 

_GUICtrlListView_SetBkColor($listview, 0x0000FF)

Then the under and side line will be red like this:

7mE67.png

But it needs to be the same color as: 0xF2F6F7

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  

×