Alaska Software Inc. - Re: XbpListbox wrong in Win98
Username: Password:
AuthorTopic: Re: XbpListbox wrong in Win98
Andreas Gehrs-Pahl
Re: XbpListbox wrong in Win98
on Wed, 01 Aug 2007 19:41:52 -0400
Joe,

>In WinXP and Windows Vista, a populated Listbox shows the first item in 
>line 1.

>In Win98 there is a blank line at the top of the listbox. Consequently, 
>the dataref is offset by 1. This makes it impossible to compare the 
>original array index with the listbox properly.

I have never seen this with any XbpListBoxes, and our clients use virtually 
all Windows versions, except maybe Vista. And it works with all Xbase++ 
versions that I have used, including the latest 1.90.331 with HotFixes.

Can you post an example program that fails on Windows 98 but works on 
Windows XP? I would like to see this for myself, as I suspect some sort 
of programming (style) issue, which can probably be worked around.

-- Andreas

---                                                                      ---
  Andreas Gehrs-Pahl              E-Mail: GPahl@CharterMI.net
  415 Gute Street                     or: Andreas@DDPSoftware.com
  Owosso, MI 48867-4410               or: Andreas@Aerospace-History.net
  Tel: (989) 723-9927           Web Site: http://www.Aerospace-History.net
---                                                                      ---
James Loughner Re: XbpListbox wrong in Win98
on Wed, 01 Aug 2007 21:23:42 -0400
I've seen this only sometimes but always in cases of fairly complex
inheritance of the parent dialog and afaik only on Win98. It is very
difficult to reproduce in a simple system.

Andreas Gehrs-Pahl wrote:
> Joe,
> 
>> In WinXP and Windows Vista, a populated Listbox shows the first item in 
>> line 1.
> 
>> In Win98 there is a blank line at the top of the listbox. Consequently, 
>> the dataref is offset by 1. This makes it impossible to compare the 
>> original array index with the listbox properly.
> 
> I have never seen this with any XbpListBoxes, and our clients use virtually 
> all Windows versions, except maybe Vista. And it works with all Xbase++ 
> versions that I have used, including the latest 1.90.331 with HotFixes.
> 
> Can you post an example program that fails on Windows 98 but works on 
> Windows XP? I would like to see this for myself, as I suspect some sort 
> of programming (style) issue, which can probably be worked around.
> 
> -- Andreas
> 
> ---                                                                      ---
>   Andreas Gehrs-Pahl              E-Mail: GPahl@CharterMI.net
>   415 Gute Street                     or: Andreas@DDPSoftware.com
>   Owosso, MI 48867-4410               or: Andreas@Aerospace-History.net
>   Tel: (989) 723-9927           Web Site: http://www.Aerospace-History.net
> ---                                                                      ---
Joe Carrick Re: XbpListbox wrong in Win98
on Thu, 02 Aug 2007 08:30:11 -0700
Hi Andreas,

The code that works on WinXP and Windows Vista but fails on Win98 is:

	nData := 1

	oLbx := XbpListBox():new(oDlg:drawingArea,,{nX,80},{200,200} )
	oLbx:group := XBP_WITHIN_GROUP
	oLbx:tabStop	:= .T.
	oLbx:SetFontCompoundName( "10.Arial Bold" )
	oLbx:markMode	:= nMarkmode
	IF len(aUsers)<13
		oLbx:vertScroll := .F.
	ENDIF
	oLbx:create()
	goto nData
	AEval( aUsers, {|c| oLbx:addItem(c) } )
	oLbx:setdata( {nData},.T. )

	oLbx:itemSelected := {|mp1,mp2,obj| ;
				mp1	:= obj:getdata()[1],1,;
				PostAppEvent( xbeUser_UserMarked,mp1 ) }

It's pretty generic code.  I can't post the entire dialog but it's just 
a Top Level Modal Dialog to get the user login to my app.  The only 
other Xbp's on this dialog is a XbpSle for password entry and a 
XbpPushbutton "Done".  aUsers is populated with user names and nData is 
supposed to match the position of the corresponding record in "user.dbf"

The code executed for xbeUser_Usermarked is:

	select users
	go top
	locate FOR alltrim(NAME)==alltrim(aUsers[mp1])
	SetAppFocus( oPW )

but this really has nothing to do with the problem I reported.  BTW, I'm 
using v 1.90.331 so that's not the issue.


I'm going to add:

	oLbx:clear()

after the create and see if that fixes the problem.  I won't be able to 
test it until next week because I won't be at a Win98 system until Monday.


Andreas Gehrs-Pahl wrote:
> Joe,
> 
> 
>>In WinXP and Windows Vista, a populated Listbox shows the first item in 
>>line 1.
> 
> 
>>In Win98 there is a blank line at the top of the listbox. Consequently, 
>>the dataref is offset by 1. This makes it impossible to compare the 
>>original array index with the listbox properly.
> 
> 
> I have never seen this with any XbpListBoxes, and our clients use virtually 
> all Windows versions, except maybe Vista. And it works with all Xbase++ 
> versions that I have used, including the latest 1.90.331 with HotFixes.
> 
> Can you post an example program that fails on Windows 98 but works on 
> Windows XP? I would like to see this for myself, as I suspect some sort 
> of programming (style) issue, which can probably be worked around.
> 
> -- Andreas
> 
> ---                                                                      ---
>   Andreas Gehrs-Pahl              E-Mail: GPahl@CharterMI.net
>   415 Gute Street                     or: Andreas@DDPSoftware.com
>   Owosso, MI 48867-4410               or: Andreas@Aerospace-History.net
>   Tel: (989) 723-9927           Web Site: http://www.Aerospace-History.net
> ---                                                                      ---
Andreas Gehrs-Pahl
Re: XbpListbox wrong in Win98
on Thu, 02 Aug 2007 13:43:29 -0400
Joe,

>I'm going to add: oLbx:clear()
>after the create and see if that fixes the problem. I won't be able to 
>test it until next week because I won't be at a Win98 system until Monday.

Yes, this might help. I only use my own, derived, ListBox class, so I really 
don't know for sure if there is a problem in the base class. But I also use 
the :Clear() method before adding (or changing) values. Here is a small code 
snippet:

************************************
* DDP_DlgListBox: SetValues Method *
************************************
Method DDP_DlgListBox:SetValues(aListArray)
LOCAL aMarked := ::GetData()               Keep selection
   ::Clear()
   ::cSearchText := ::cFindText := ''      Reset incremental and
   ::nLastFound  := 0                      full-text search strings
   if aListArray # NIL
      ::aListArray := AClone(aListArray)   Update code-replacement array
   endif
   AEval(::aListArray, {|a| ::AddItem(a[2])})
   ::SetData(aMarked, .t.)
return (Self)

-- Andreas

---                                                                      ---
  Andreas Gehrs-Pahl              E-Mail: GPahl@CharterMI.net
  415 Gute Street                     or: Andreas@DDPSoftware.com
  Owosso, MI 48867-4410               or: Andreas@Aerospace-History.net
  Tel: (989) 723-9927           Web Site: http://www.Aerospace-History.net
---                                                                      ---
Joe Carrick Re: XbpListbox wrong in Win98
on Tue, 07 Aug 2007 21:07:21 -0700
Thomas Braun
Re: XbpListbox wrong in Win98
on Wed, 08 Aug 2007 08:30:21 +0200
Joe Carrick wrote:

> Just to update.  :clear() didn't fix the problem.  I really don't know 
> what to do except upgrade the Win98 systems to WinXP or Vista Premium. 

It's high time to do so anyway... Win98 is nearly ten years old.

Thomas
Andreas Gehrs-Pahl
Re: XbpListbox wrong in Win98
on Thu, 09 Aug 2007 19:51:53 -0400
Joe,

>Just to update. :clear() didn't fix the problem. I really don't know 
>what to do except upgrade the Win98 systems to WinXP or Vista Premium. 

I still use Windows 98SE regularly and have never seen this problem. But 
unless you can come up with an example that shows it, I suppose updating 
to XP is all you can do. I still suspect a programming logic issue, though.

-- Andreas

---                                                                      ---
  Andreas Gehrs-Pahl              E-Mail: GPahl@CharterMI.net
  415 Gute Street                     or: Andreas@DDPSoftware.com
  Owosso, MI 48867-4410               or: Andreas@Aerospace-History.net
  Tel: (989) 723-9927           Web Site: http://www.Aerospace-History.net
---                                                                      ---