Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Getting RowNumber or Value from Group Header in Datawindow.

2,340 views
Skip to first unread message

Russ Colburn

unread,
May 1, 2006, 12:20:17 PM5/1/06
to
PB 9.01 build 7096.

I have a grouped datawindow that I want to determine the first row in group
(or get a value from the header of the group) when the user double clicks
on the group header band.

I have spent time looking in Help files, online books and searching the news
group, but nothing specified actually works.

I've tried accessing values from DWO,
GetBandAtPointer (returns "background~t0" even though documentation says it
should return the group n and first row in group)
GetObjectAtPointer (returns empty string )
__get_attribute
GetRow()

I know I can reference the value in a computed column for a group header if
I know the row number of a row in the group. The problem is I can't find a
way to get a row number of any of the rows within the group that the user
double clicked.

I've got to believe someone else has done this in the past, but I can't seem
to get anything to work.

Anyone have any Idea how to make this work?

Thanks,

Russ


Ken Balakrishnan

unread,
May 1, 2006, 1:45:59 PM5/1/06
to
Hmm, GetBandAtPointer is what you would ordinarily use for this. Not to be
skeptical, but are you *sure* you called Get*Band*AtPointer and not
Get*Object*AtPointer when you got the return value of "background~t0"?
Because "background" isn't one of the expected return values for the former
(but it is for the latter). If that's genuinely the return value you get
from GetBandAtPointer, then maybe there's a bug in that build of PB9 -- you
might try upgrading to the latest build. Anyway, this function works as
expected for me in PB9.0.2 build 7578.

Ken

"Russ Colburn" <No_Russellc_SpamatAccidentFunddotcom> wrote in message
news:4456245c$1@forums-2-dub...

Russ Colburn

unread,
May 1, 2006, 2:22:32 PM5/1/06
to
I'm absolutely sure about using Get*Band*AtPointer (because I've got both
coded). Unfortunately this has to go to production long before we could
upgrade and do the regression testing needed to prove a new release. (I'm
hoping to get us to 10.5 later this summer.)

Anyone have any other ideas to try for a workaround?

Thanks,

Russ
"Ken Balakrishnan" <kNOe...@cps92.com> wrote in message
news:44563871$1@forums-2-dub...

Ken Balakrishnan

unread,
May 1, 2006, 2:54:05 PM5/1/06
to
Well, if GetBandAtPointer isn't working, then who knows what else might not
be either, but one suggestion would be to add a transparent object (e.g. a
Text object) that spans the full width and height of the group header
area -- then when the user clicks in the group header, GetObjectAtPointer
should return the name of that object and the row it belongs to.

"Russ Colburn" <No_Russellc_SpamatAccidentFunddotcom> wrote in message

news:445651e8$1@forums-1-dub...

Russ Colburn

unread,
May 1, 2006, 3:36:20 PM5/1/06
to
GetObjectAtPointer returns an empty string when clicking on text, computed
column or empty area of the header, or a column in the detail band or on
background of detail row. It looks like both GetObjectAtPointer and
GetBandAtPointer are broke in this release. :-(

Russ
"Ken Balakrishnan" <kNOe...@cps92.com> wrote in message

news:4456594d$1@forums-1-dub...

Ken Balakrishnan

unread,
May 1, 2006, 4:29:47 PM5/1/06
to
Jeez, that's a bummer. I guess I shouldn't have doubted you -- Google
Groups shows a couple other people reporting the same issue. I don't know
what else you could do, short of trying to calculate it based on the
FirstRowOnPage property and the y value they clicked on (ugh!), or
re-architecting the dw to use fake groups with extra detail records. Sorry.

Ken

"Russ Colburn" <No_Russellc_SpamatAccidentFunddotcom> wrote in message

news:44566334$1@forums-1-dub...

Russ Colburn

unread,
May 4, 2006, 8:52:22 AM5/4/06
to
For those who may be experiencing this or similar problems.

It turns out that there were two problems I was seeing.
1) The debugger apparently has a problem as I would always get
"background~t0" from the GetBandAtPointer function while in the debugger.
Another developer would sometime get the correct values in the debugger as
long as he used the "step in" vs. "step over" buttons in the debugger, but I
never got the correct value in the debugger. Using a message box to debug I
was getting the correct values most of the time.
2) The second problem was if you used the mouse to grab the scroll bar
control and dragged it to a new page something would get out of sync and I
would again get the background 0 response. Once you clicked on the scroll
bar arrows, or the empty space between the control handle and arrows it
start working again.

My workaround was to put code in the clicked event (as my code was in
doubleclicked) to save the first row on the page, scroll to row 0 then
scroll back to the first row on page. Then I would get the header.4
rownumber as expected in the doubleclicked event.

I hope this can help some others out there.

Thanks for you help on this Ken.

Russ
"Ken Balakrishnan" <kNOe...@cps92.com> wrote in message

news:44566fbb$1@forums-1-dub...

philipsalgannik

unread,
May 8, 2006, 11:35:51 AM5/8/06
to
What I did in the past is having a TEXT object in the group
header which is used as a hit spot for doubleclicking.
In that case the code for doubleclicked event is simplified
to something like:
string ls_obj
long ll_row

IF dwo.name = GROUP_TITLE THEN
ls_obj = GetObjectAtPointer()
IF Len(ls_obj) > 0 THEN
ll_row = Long(Mid(ls_obj,
Len(GROUP_TITLE)+1))
If ll_row > 0 THEN

Russ Colburn

unread,
May 9, 2006, 12:59:22 PM5/9/06
to
In my case with my specific release and ebf, both the GetObjectAtPointer and
GetBandAtPointer were "broken" once the user scrolled the DW using the
scroll handle. Forcing scrolling using another mechanism (user interface or
programmatically) was required to get either option to work. Once the
scrolling was "re-synchronized" both options work.

Russ
<Philip Salgannik> wrote in message
news:445f654f.667...@sybase.com...

bsa...@gmail.com

unread,
Nov 14, 2014, 8:35:44 AM11/14/14
to
I had the same problem when using the GetBandAtPointer(), it always returned "background0". I tried this tip, but it did not work unfortunately. I then added setRedraw(false) and setRedraw(true) around the ScrollToRow functions and then it worked! It returned "detail0" if I clicked in the detail band and "header0" if I clicked in the header band. Here is the code:
Long ll_FirstRowOnPage
this.setredraw(false)
ll_FirstRowOnPage = Long( this.Object.DataWindow.FirstRowOnPage )
this.ScrollToRow( this.rowcount() )
this.ScrollToRow( ll_FirstRowOnPage )
this.setredraw(true)
ls_band = this.GetBandAtPointer ( )
if pos(ls_band,'header') > 0 then
this.Object.c_rowindicator_main.visible = True
else
this.Object.c_rowindicator_main.visible = false
end if

Maybe this can help other frustrated developers with the same problem.

Regards Berit
0 new messages