Re: [perl-win32-gui-users] using Win32::GUI::Grid
Hi, I think the problem in your sample is InsertColumn. InsertColumn (strHeading, [nFormat = DT_CENTER|DT_VCENTER|DT_SINGLELINE], [nColumn = -1]) => return icol You set Laurent. > > I am trying to use Grid.pm to display rows after rows > of data I retrieve from a DB2 database. The problem is > that I don't know how many rows I am going to be > displaying ahead of time I need to do it dynamically. > So I declare teh grid like this: > > my $Grid = $W->AddGrid ( > -name=> "Grid", > -pos => [70,80], > -width => 890, > -height => 490, > -editable => 0, > ) or die "new Grid"; > $Grid->Hide; > > And much later. I create the output headings, ie the > very first rows of the database has the column names of > the databae table. as in. > SECTIONA > > # codes to extract fieldnames(ie columns) from DB2 > # blah blah blah. > > # now enter those field names into Grid > my $i=0; > $Grid->InsertRow($fieldnames[$i],$i); > for( $icol = $i++; $icol <= $#fieldnames; $icol++ ) { > $Grid->InsertColumn($fieldnames[$icol],$icol); > } > > SECTIONB > > Then I start reading in from the database into an > array @arraydata each loop I would read in a row of > data into @arraydata and I then try to insert into the > grid this row using the following methods. IT DOES NOT > WORK!! > > my $rowcnt=1; > while( @arrayData = $sth->fetchrow_array() ) { >$node_name = shift @arrayData; >my $subitemcnt=1; >$Grid->InsertRow($node_name,$rowcnt); >foreach my $fieldData (@arrayData) { > > $Grid->SetCellText($rowcnt,$subitemcnt,$fieldData); > $Grid->Refresh(); > $subitemcnt++; >} >$rowcnt++; > } # endwhile > > The only things that gets displayed is just one single > row from the sectionA of the codes above. SEction B > data doesn't seem to get displayed at all :( > What is the trick to doing dynamic data with Grid? > What am I doing wrong?? :( <>
Re: [perl-win32-gui-users] RE: using Win32::GUI::Grid
My previous message was unfinished ;o) The second parameter of InsertColumn is the cell format not Column index. I put a small sample with InsertColumn and InsertRow as attached file. Laurent. --- From: "Chris Wearn" > # Create Grid control > $gridProcDataView = new Win32::GUI::Grid ( > -parent=> $ResultWindow, > -name => "gridProcDataView", > -left => 0, > -top => 246, > -width => 590, > -height=> 174, > -vscroll => 1, > -hscroll => 1, > -fixedrows => 1, > -columns => 10, > -editable => 0, > ) or die "can't create new Grid for - gridProcDataView."; > > # Hmmm doesn't appear to work without this. > $gridProcDataView->Resize (590, 174); It's a bug in Grid.pm, i misspell -height (i write -heigth line 159) Use -size => [590, 174] it's work. I correct this in a next release.
RE: [perl-win32-gui-users] Tooltips - do they work?
Thanks for the example, still not working... Also, I can't seem to get any of the events working when using the -event option in your example !? I'm using 665, perl 5.6, the binary from http://perso.club-internet.fr/rocherl/Win32GUI.html Bizarre stuff. Cheers, jez. From: "Frazier, Joe Jr" <[EMAIL PROTECTED]> To: "Jeremy White" <[EMAIL PROTECTED]> CC: Subject: RE: [perl-win32-gui-users] Tooltips - do they work? Date: Mon, 7 Jul 2003 07:18:09 -0400 Jeremy, try this. It works on my machine (Win2k, AP 626). Just mouse over the button and the tip should should up in a few seconds. BTW, I have been able to dynamically change tip's within a systray menu, but have not tried on a standard control (button, etc). use Win32::GUI; my $Window = new Win32::GUI::Window ( -name => "Window", -topmost => 1, -left => 300, -dialogui => 1, -top=> 400, -width => 222, -height => 235, -text => "Test", # -events => { Terminate => sub { print "Dying\n"; return -1 }, #Activate => sub { print "here I am!\n"; }, }, #-onMinimize => sub { print "no please!\n"; }, ); $Window->AddDateTime( -top=> 1, -left => 1, -width => 180, -height => 25, -name => "dateFromT", -events => { #Click => sub { print "Got a Click\n"; }, LostFocus => sub { print "Lost Focus\n"; }, }, -onClick => sub { print "Got a Click\n"; }, -onChange => sub { print "Got a Click\n"; }, ); $Window->AddButton( -name =>"but", -top => '30', -left => '1', -text => "TipTest", -tip => "This is a Tip!", -width => 150, -height => 25, ); #$Window->dateFromT->CheckBox(1); $Window->dateFromT->Format('MM/dd/ HH:mm:ss'); $Window->Enable(); $Window->Show(); Win32::GUI::Dialog; Joe Frazier, Jr. Technical Support Engineer Peopleclick Service Support Tel: +1-800-841-2365 E-Mail: mailto:[EMAIL PROTECTED] > -Original Message- > From: Glenn Linderman [mailto:[EMAIL PROTECTED] > Sent: Saturday, July 05, 2003 4:36 PM > To: Jeremy White; perl-win32-gui-users@lists.sourceforge.net > Subject: Re: [perl-win32-gui-users] Tooltips - do they work? > > > On approximately 7/5/2003 1:03 PM, came the following characters from > the keyboard of Glenn Linderman: > > > On approximately 7/5/2003 9:51 AM, came the following > characters from > > the keyboard of Jeremy White: > > > >>> From: Glenn Linderman <[EMAIL PROTECTED]> > >>> > >>> Unfortunately, the examples that I have are not suitable > for including > >>> in documentation, as I pass things through a couple > layers of wrappers > >>> before it gets to a real Win32::GUI call. But the gist > of it is just > >>> to add > >>> > >>> -tip => 'Configuration options menu', > >>> > >> > >> Thanks for the reply - I created a simple window, with one > button with > >> the tip option included. Still nothing tried it under 5.6, > and 5.8, > >> both with 665. Im on XP. Do I need to create event handlers or > >> anything? I am just being stupid!? > >> > >> Perhaps, I should say what I think should happen - just in > case Im > >> barking up the wrong tree - when the mouse hovers over the > button, the > >> little yellow box should appear with the text that was > specified in > >> the -tip option? > > > > > > Indeed, that is the sort of behavior you should expect, and > that I get, > > with Win2K SP3 or SP4 (worked on both), Perl 5.8 build 805, > Win32::GUI > > build 0.0.665. > > Oh, and maybe I should mention that tooltips don't _always_ > show up. It > seems that if another process is consuming all the CPU cycles, that > tooltips are not displayed during that time. Maybe it is some > "benevolent" way of shedding CPU activity since it is so > loaded already? > However, when I'm using a program that has tooltips, and they don't > show up, I get aggravated but I do have a program that > periodically > slurps up all my CPU cycles, so I guess it is my own fault... > but still, > I think the tooltips should show up if you leave your mouse > there long > enough. > > -- > Glenn -- http://nevcal.com/ > === > Like almost everyone, I receive a lot of spam every day, much of it > offering to help me get out of debt or get rich quick. It's > ridiculous. > -- Bill Gates > > > > --- > This SF.Net email sponsored by: Free pre-built ASP.NET sites including > Data Reports, E-commerce, Portals, and Forums are available now. > Download today and enter to win an XBOX or Visual Studio .NET. > http://aspnet.click-url.com/go/psa0016ave/direct;at.asp_06 > 1203_01/01 > ___ > Perl-Win32-GUI-Users
Re: [perl-win32-gui-users] Tooltips - do they work?
Same problem for me. I replace $Window->AddDateTime( with new Win32::GUI::DateTime( -parent => $Window, And Tootip work on Button. I don't see any NEM (New Event Model) availlable on DateTime Control in Win32::GUI Source code. Only generic event are available -events => { MouseMove => sub { print "MouseMove\n"; }, MouseDown => sub { print "MouseDown\n"; }, MouseUp => sub { print "MouseUp\n"; }, KeyDown => sub { print "KeyDown\n"; }, KeyUp => sub { print "KeyUp\n"; }, } Laurent. From: "Jeremy White" Subject: RE: [perl-win32-gui-users] Tooltips - do they work? > Thanks for the example, still not working... > > Also, I can't seem to get any of the events working when using the -event > option in your example !? > > I'm using 665, perl 5.6, the binary from > http://perso.club-internet.fr/rocherl/Win32GUI.html > > Bizarre stuff. > > Cheers, > > jez.
[perl-win32-gui-users] displaying an empty Grid?
I wonder what the behaviour of the Win32::GUI::Grid should be if you have created a grid and before you do anything with it you just want to set it on $Grid->Show This is what I have observe. WHen I launch my program up, I have to connect to a database, ie. this picture. http://www.geocities.com/corvette_2050/huh0.jpg Then after I have connected to the database, I can if I want display it (data) on the grid by clicking on the Refresh button as shown here in this photo. http://www.geocities.com/corvette_2050/huh1.jpg However if you look at the above photo, I had intentionally wanted to display a fresh/empty Grid prior to being filled with database info. However when I invoked $Grid->Show before actually calling SetCellText(...), this is what I see (above photo) This grid is displayed but it is unproportional. Is there something I am missing? $Grid = $W->AddGrid ( -name=> "Grid", -pos => [70,80], -size => [890,490], -fixedrows=> 1, -fixedcolumns => 1, -editable => 0, ) or die "new Grid"; $Grid->SetRows(58); $Grid->SetColumns(20); $Grid->Hide; Much later. $Grid->Show; Then later on... after user click Refresh. while(@DataRowFromDB = $sth->fetch ) { foreach $fieldData (@DataRowFromDB) { $Grid->SetCellText($rowcnt,$subitemcnt,$fieldData); ... } } Thanks in advance