Jump to content
Sign in to follow this  
pastl

Problem with GUI Background Pic and ListView

Recommended Posts

Hello together,

1.:

i've got a little problem using a GUI with a Background Pic and a ListView. For the Background Pic i use:

$WS_EX_TRANSPARENT

so that i can edit,... my ListView. But when i trie to rise the Colums, sometime the next Colum hide's. It only comes back, when i rise it as well. Any Idea why this happens? :(

Here is a part of the Code i use:

; Uninstall - Installationsfenster:
;---------------------------------
Global $Uninstall_GUI = GUICreate("",$gui_width,$gui_child_height,0,0,$WS_CHILD,-1,$main_GUI)
$Pic_Haupt = GUICtrlCreatePic(@ScriptDir & "\Setup\Pics\uninstall.jpg",-1,-1, 800, 600, $WS_EX_TRANSPARENT )
GUICtrlSetFont(-1,14,600)

;Erstellen der ListBox/Label:
;----------------------------
Global $Uninstall_Label = GUICtrlCreateLabel (" Installierte Programme:",($gui_width -770) / 2,$gui_child_height - 400 , 230, 30)
GUICtrlSetBkColor(-1,0xd4d4d4)
GUICtrlSetFont (-1,16, 400, 2+4)
Global $Uninstall_List = GUICtrlCreateListView ("Name:                                                                                                                                   |InstallDir:                                                                         |UninstallString:                                                                                                  |Uninstallkey:                                                                                                      ",($gui_width -770) / 2,$gui_child_height - 370,770,320, $WS_HSCROLL, $LVS_EX_FULLROWSELECT)
GUICtrlSetBkColor(-1,0xd4d4d4)
GUICtrlSetFont (-1,10, 400, 2)
GUICtrlSetData(-1,_UninstallKey(), $LVS_NOSORTHEADER)

2.:

Is it possible to give each Colum a differtent size?

3.:

I trie to change the Background of the ListView with:

GUICtrlSetBkColor(-1,0xd4d4d4)

but it isn't working. What am i doing wrong?

Thank's for your help.

Greating's pastl

Edited by Jon

Share this post


Link to post
Share on other sites

I'm guessing you don't have one of the latest BETA's? Or if you do you haven't read the help file...

  • _GUICtrlListViewSetColumnWidth()
Here's more...
  • _GUICtrlListViewSetTextColor()
  • _GUICtrlListViewSetTextBkColor()
  • _GUICtrlListViewSetBkColor()
GUICtrlSetBkColor

Only Label, Checkox, Group, Radio, Edit, Input, Treeview, Graphic and Progress controls can currently be colored.

Edit: Here's link to latest BETA.

Edited by Burrup

qq

Share this post


Link to post
Share on other sites

@Burrup,

thank's for your answer. Yes i didn't use the BETA, i use 3.1.1. But now i include the ListView-UDF. :(

Have you got any idea, how i can handle my frist problem? :(

And another Thing, can you explain me _GUICtrlListViewSetColumnWidth() in a example.

I've got a ListView with 3 Colums, so what do i have to use for $i_col for each colum.

I don't understand the description in the HelpFile:

$i_col: Zero-based index of a valid column. For list-view mode, this parameter must be set to zero

THank's for your Help.

pastl

Share this post


Link to post
Share on other sites

Use the example in the help file to learn.

#include <GuiConstants.au3>
#include <GuiListView.au3>

Opt ('MustDeclareVars', 1)
Dim $listview, $Btn_SetWidth, $Btn_Exit, $msg, $Input_width, $Status
GUICreate("ListView Sets Column Width", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149)
GUICtrlCreateListViewItem("line1|data1|more1", $listview)
GUICtrlCreateListViewItem("line2|data2|more2", $listview)
GUICtrlCreateListViewItem("line3|data3|more3", $listview)
GUICtrlCreateListViewItem("line4|data4|more4", $listview)
GUICtrlCreateListViewItem("line5|data5|more5", $listview)
GUICtrlCreateLabel("Enter Column Width:", 90, 190, 130, 20)
$Input_width = GUICtrlCreateInput("", 220, 190, 80, 20, $ES_NUMBER)
GUICtrlSetLimit($Input_width, 3)
$Btn_SetWidth = GUICtrlCreateButton("Set Width", 75, 230, 90, 40)
$Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30)
$Status = GUICtrlCreateLabel("", 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))

GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
            ExitLoop
        Case $msg = $Btn_SetWidth
            If (StringLen(GUICtrlRead($Input_width)) > 0) Then
                If (_GUICtrlListViewSetColumnWidth ($listview, 1, Int(GUICtrlRead($Input_width)))) Then
                    GUICtrlSetData($Status, 'Set Column Width Successful')
                Else
                    GUICtrlSetData($Status, 'Failed to set column width')
                EndIf
            Else
                GUICtrlSetData($Status, 'Must enter a width')
            EndIf
    EndSelect
WEnd
Exit

With your first problem...

...to rise the Colums...

Do you mean change the width? by clicking on the resize thing and dragging it? When your column 'hides' click the resize thing in between the columns either side of it and drag it to the left. Example.

You have columns 1,2 and 3. Column 2 gets hidden. Drag the resize thing in between column 1 and 3 to the right, so that you can see column 2 again.

Edit:

$i_col is the index of the columns... If have have 3 columns like above, the index of the first will be 0, 2nd will be 1 and the last will be 2.

Its like having an array.. Dim $blah[2], the number is 2 but theres really 3 thing because it starts on zero, 0,1,2. The very first column is 0, and then it goes up by 1 for every column after that

Edited by Burrup

qq

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...