Hi All,

Have been experimenting with the Listview control, and noticed several
features are TBD... Of course these are the ones I want to use...

I wish to use the listview control in "Icon" view (see
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon98/html/vbconusinglistviewcontrol.asp
 for diff examples of how the control can be used).

Although -report and -list are in the constructors class specific
options, you can also set the style by using "View" (which is currently
TBD), you can set the view mode using:

$lvwChart->View(0); # Set View to LargeIcon

The View Properties are:
0 - lvwIcon
1 - lvwSmallIcon
2 - lvwList
3 - lvwReport

At the end I have included an example, however for this mode to become
more useful, you need to be able to move the item around by dragging
them to a new location. For example - objects in MS Visio.

This requires the use of LVN_BEGINDRAG or LVN_BEGINRDRAG.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/listview/notifications/lvn_begindrag.asp

Providing then, if the left or right mouse button is depressed and moved
over ListItem, typically four pixels in any direction, the real listview
sends its parent window a LVN_BEGINDRAG or LVN_BEGINRDRAG notification
message, respectively. It then begins repositioning the ListItem under
the cursor. The ListView does not respond to LVN_BEGINRDRAG, and
provides no right button item dragging facility. Once either
notification has been processed and dragging has begun, the ListView
stops raising its MouseMove event, until the respective button is 
released.

There are quite a few other Methods that appear on the MSDN site:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/listview/listview_message_processing.asp

What is required or is there anything that prevents these methods being 
implemented (barring time, hardwork and knowledge) ?

Chris Wearn

# ============= The example ============


# ============================
# Listview Large Icon example
# ============================

use Win32::GUI;
use Win32::GUI::BitmapInline ();

$bmpComputer = new Win32::GUI::BitmapInline( q(
Qk02DAAAAAAAADYAAAAoAAAAIAAAACAAAAABABgAAAAAAAAMAAATCwAAEwsAAAAAAAAAAAAA////
/////////////////////////////////v7++fn65eTkyMDBsqKiqJKSo4uNoYmLnYODnYmKqJyc
vLi61NPU7Ozt/Pz8/v7+////////////////////////////////////////////////////////
////+/v72dLTrpeXqYWFuJyeyLW2z7y90bu80Li5zrS0yqytvJaYqH5/lnFwloeIvLq76Onq/f39
////////////////////////////////////////////////////9PPzuJ6fuZ6g1cvM3tvb3NjZ
3NXV2tHR2MzM18jI1cLCwZ6fwZma0rGz0qytv5KSmnFxl4qM1dXW/Pz8////////////////////
////////////////////////+ff3u52e0sfI4+fn4ePk4OHh3t7f29rZ2tTU2dHR18vMu5SWtpaY
noKCnHBys4aIzqam0KOkq3p6lISF4ODh/v7+////////////////////////////////////////
3czNz8HB5+zt5ubn6ejo6enp5ebm4OHh29ra3NjX0L6/wpqb2NLTnZGSnouLmXd3rH+A1auqzJyc
o3V2v7u8+/v7////////////////////////////////////////0Li44N7d6+zt7u7u8fHw8PDw
7Ozs5ubn39/g3dzcy7W1y6enzru7oH9/poaGpoOCso2N0Kio0KOjtYODu7Gy+vv7////////////
////////////////////////////2cLD4d3d7/Hy9vb0/P37+vr58fDw6Ojp4eLi3Nzcxqam0K+w
xaWmqHt5rn5+rXl4uoiI0Kqq0aKjtoSEzsfH/f7+////////////////////////////////////
////8efn18bG8fX1+Pj3/fr7/f//9fn56eno4ePj2dbXw5ia07GxvIiJs3V1tXd2s3JyvoaH0a2t
ypubu5qa8/Pz/v7+/////////////////////////////////////////v7+6dra4dbW7+zt0qms
0q2w4dHS6ezr5Ovr1srJxZaX06qqtnR0tG9xs25wsmtrwIiKzaSkwpub7+zs/v7+////////////
/////////////////////////////////////v7+9Ozs1ri5u31+wIOEwYiPv46Uy7O1yaamy5ub
w4qLsGlqr2hpr2dorWRjtHx80by8+Pf3////////////////////////////////////////////
////////////////////6dnavIGC0Zpw4rmU1KWcxI6VuXqCtXJ1rWJhrGJfrGNgrGFfqFxbrpGS
9fX1/////////////////////////////////////////////////////////////////v7+3sfJ
wYaAy41D1Jg32qRU3q5y27CUzJuYuHh+rGNopldUpFJPnExJsZ2d+Pn5////////////////////
/////////////////////////////////////////////f390K+zxYx605lG2KBF2Z9C2aA+3KVG
4K5f37OC0aGPv4aKrWRqm0tLmoeI0dPT8vPz/f39/v7+////////////////////////////////
////////////////////9/T0xJykyJBy3KRD3adI36hK36pK36tK4KpI4atH47BU4bFn2qyDyZKH
sHN2mW91opKTw8HC6uvs/f39////////////////////////////////////////////////7+jo
wpacy5Zm4qxF4q1O47BQ5LFR5bNT5LJU5bNV5LJS5LFQ5LFO5LJa361u0Zd5u3p2m2VoqJqa8vLz
////////////////////////////////////////////////4tbXxZud0KBi5rNP5bRX5rZZ6Llb
6bla6Llb6bpc6bpc6blb57dZ5rZW5rVS5rNR5bJYzYlipoGB7e/v////////////////////////
/////////////////////fz807/DxZyX2Kle6rlX6rpd671f7b9i7MBi7MBi7cBi7cFj7cBi7L5h
67xf6bpd6Lda67tUzY5Wq4qL8vPz////////////////////////////////////////////+vj5
ya+1wp2S4bRb7sFf7sJk78Rn8MZq8MZr8cds8sds8cds8cdr8MVo78Nm7cFk671g78JbxoVdsZaZ
9vf3////////////////////////////////////////////8e7uxquxxaCI6b5h8cZn8Mdr8spu
9Mty9M1z9M5z9c909c509M1z8stw8slt8cdr78Rn8cVhvn5gtqOm+fr6////////////////////
////////////////////////4trbyK60x6R+7sZo88tv9M109tB49tN899N+99R/99V/99R/99R+
9tF69tB29M1z9Mxu78NpuHpkvrK1+/z8/////////////////////////////////////////v7+
2c7QybO3z6x29s1v9tB299J899WC+NaH+NeL+NeN+NeM+NeN+NiL99aH+NSA9tN799J27L9vsnVm
yMDC/f39////////////////////////////////////////+/v70sfIwayv17Vz+9R299N/+NaH
+NiO+NmT99qY99ua99ua9tua99uX+NmS+NiN99aG+td+6Lp2rnNs0MzO/v7+////////////////
////////////////////////8/Hxyr3BxLCn4L93+9d/+NaI99mS99qZ9t2f9N2l9N+o9N+o9N+n
9N2i9tye99uW+NmP+9uJ4bN8qHFy2dbY/v7+////////////////////////////////////////
6ObmzsLIwq6c6sl7+deG+NmS9tub9d6j9OCr8uGv8+Kz9OO09OOz8+Kv9N+p9d2i99uZ+92Q3at9
pXh74+Lj/v7+////////////////////////////////////////3NjYzsjPv6uM+dWB+9uN+t6Z
9+Cl9OGs8+O08uW78+fA8+fB8+a+8uS69OOy89+p9d2h+NuW16J9qISH7Ozt/v7+////////////
////////////////////////////ysfIzsjMpZaKxq+K28GQ58yc7den9OO2+u7E9+7L9e7P8+zO
8urL8ujE8+W79OKw9eCn89mbzpZ8rJCT9PT0////////////////////////////////////////
////wsHC4t/go5qbm4+SmoqMn4uKqJOKtJ2Rwqyf08Gx5dnE8evU9O/V9e7O9+zF9ui5+OWu8tef
xYx7sJye9/j4////////////////////////////////////////////xcXH09TV3NnZ087OzMPG
yLu+wrO0s5+hqZGTpIiJo4OCp4aEt5mSyK6h2sSt5Myt79mq79SguX94t6ir+vr6////////////
/////////////////////////////////f397e3t5ePk7+7u4d/f0svMyb6/yr2/z7/A1MTE0r2+
xausuZiZsYuNqX+BrYGAtoqDv5CCrHd2wrm6/Pz8////////////////////////////////////
/////////////////////////////////v7++/r68e/v39jY1MjJ3tLT18fI1sDBzrKzxqSmxqGj
wJWYpXp71dDR/v7+////////////////////////////////////////////////////////////
/////////////////////////////v7++fj48Ovr8u7u7OTk3MvLwp2ex66v+fn5////////////
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
) );

$imlChart = new Win32::GUI::ImageList(32,32,24,2,10);
$imlChart->Add($bmpComputer,0);

$winMain = new Win32::GUI::Window(
#====================================
        -name   => "winMain",
        -title          => "Listview Control",
        -pos            => [100,100],
        -size           => [500,500],
        -dialogui       => 1,
);

$lvwChart = $winMain->AddListView(
#====================================
        -name           => "lvwChart",
        -text           => " ",
        -left           => 5, 
        -top            => 30,
        -width          => 480,
        -height         => 420,
        -autovscroll    => 1,
        -autohscroll    => 1,
        -hottrack       => 1,
        -visible        => 1,
        -nocolumnheader => 1, 
        -imagelist      => $imlChart,
);
$lvwChart->View(0); # Set View to LargeIcon

# View Properties
#       0 - lvwIcon
#       1 - lvwSmallIcon
#       2 - lvwList
#       3 - lvwReport

$lvwChart->InsertItem(
#=========  ITEM 1  =================
        -image          => 0, 
        -text           => [ "Computer 1" ]
);
$lvwChart->ItemPosition(0,80,100);

$lvwChart->InsertItem(
#=========  ITEM 2  =================
        -image          => 0, 
        -text           => [ "Computer 2" ]
);
$lvwChart->ItemPosition(0,160,200);

$lvwChart->InsertItem(
#=========  ITEM 3  =================
        -image          => 0, 
        -text           => [ "Computer 3" ]
);
$lvwChart->ItemPosition(0,240,300);


$winMain->Show();
$winMain->Enable();
Win32::GUI::Dialog();

sub winMain_Terminate {
    return -1;
}

#====================================
# EVENTS
#====================================

sub lvwChart_ItemClick {
        #====================================
        my($index)      = @_;   # ItemClicked
        my %item        = ();
        my $itemtext    = "";
        my $x           = "";
        my $y           = "";

        %item = $lvwChart->ItemInfo($index);
        $itemtext = $item{-text};
        print "Clicked Item $index: $itemtext\n";
        
        ($x,$y) = $lvwChart->ItemPosition($index);
        print "Position X-$x Y-$y\n";
        
        #$lvwChart->MoveItem($index,$mouseX,$mouseY);
}









Reply via email to