Link to home
Create AccountLog in
Avatar of LennyGray
LennyGrayFlag for United States of America

asked on

Visual FoxPro V9 Screen problem

I just converted a VFP8 application to VFP9. The application consists of many tables and many screens. However, only one of my screens has a problem where one of my listboxes no longer works. The listbox is on a tab control with five tabs (pages). Other listboxes on other tabs (pages) on the tab control work with the same class.

The problem seems like the listbox is not enabled because when I double-click a data item in the listbox, it is not being selected and sent to another listbox control on that page of the tab.

This data screen has a tab control that has 5 pages. On each page are two listboxes. The left list box contains an array of data and the right listbox contains the data items that the user selects from the left list box by double-clicking. The user double-clicks on items in the left listbox to select that data item into the right listbox.

On four of the five pages in the tab, these listboxes function as designed. In fact, each of the five pages in the utilize the same class to operate the transfer of data from the left listbox to the right listbox. Page 1 is the bad boy. This guy does not want to operate like its siblings in pages 2-5.

Instead, this guy acts like he is not enabled. Double-clicking has no effect (I even put a message box in the event and no message box was raised). And then, if I go to another page on the tab and return to page 1, sometimes this guy on page 1 will react properly and other times it seems to act as though the listbox control was not enabled or it was locked.

There were no code changes after the conversion from 8 to 9. This screen simply does not want to work properly.

I thought that there was a broken control, so I deleted the old controls, recompiled, shutdown VFP, restarted VFP, recreated the controls, attached the calls and it still did not work.

Attached is the code for your reference

Please help me; I am at my wits end.

Avatar of LennyGray
Flag of United States of America image


Copy this link into your browser for the zip file:

I had to do this because of the EE inline filters that excluded some Foxpro extensions. You will need to enter your login name again and password.
Avatar of Olaf Doschke
I already answered that one in detail, but you made a deletion request. No reason, as, I didn't abandoned the question, there is just less time between christmas and new year.

One thing is true for sure: I couldn't run that form, the form errors to not find C:\justtheform\allsysteminfo.dbf. Now I copied the "JusttheForm" folder to C:\ and can run it, still it does not populate any listbox of any of the pages.

The init code setting the Rowsource is wrong for sure:

this.RowSource = 'SelectedTableFieldInfo.FieldDesc '

Open in new window

I don't get to the cboDataSource.InteractiveChange event, that combobox always stays disabled, same goes for cboReports. You haven't isolated the form in a way I/we could test it. Selecting any

In regard to saving as a class: It's not needed, I now found the cntMover class.

But to repeat what I said: before choosing "Save As Class" from the menu you need to "select one of the working combinations of two listboxes in a container with buttons". Only if you first select the bunch of controls you want to put into a single class, you can save this bunch of selected controls as a class instead of the whole form.

You don't need this here but it can become handy in refactoring a form.

I can only get a list of items into the first page by choosing "Atom:..." in the first combobox, then can choose "AP Details" as data source and then the listbox is populated. DblClick doesn't work for me, though it should, I don't see anything blocking (note: I reverted the listbox.init() to it's default of having no code at all, no Rowsource is set).

I think I can't help you with that, sorry.

Bye, Olaf.
This seems to be an escalated bug in VFP 9 and Microsoft can fix it if you'll pay enough...

The listbox is enabled and if you press a mouse button on it and drag the cursor then the selection will appear/move. Keyboard also works.

You are not correct when saying "This guy does not want to operate like its siblings in pages 2-5." because listboxes on other pages are behaving similar (wrong) way - some items are selectable, some others not...

The possible and tested work around was to remove container and place list boxes and buttons directly onto the page surface... Horrible work, I know.

It should be possible to find some other work around, e.g. to use a cursor as the Listbox row source. Or to replace Listboxes by Grids...

BTW, even VFP 8 was hanged on this form under certain circumstances. It seems this way of listboxes usage does not offer sufficient stability... :-(

I am just lazy to test some simple form having listboxes in container on a page but the result would probably be exactly same...

The fact Microsoft stopped VFP development is a good message now. I believe the new version created by independent company will be much better.
Olaf -

I apologize if I had offfended you.

We are all volunteers here and I greatly appreciate your help.

As an EE Access Master, I have assisted many people here with their code. But, I am also busy with my personal assignments and sometimes I simply do not have the time to answer a question quickly. When I run into that kind of problem, I usually let the questioner know that I got the question but I will be delayed in answering it. In this way they do not feel that they are being ignored or abandoned.

So, again, please forgive my crassness.

And, Happy New Year!

Avatar of Pavel Celba
Pavel Celba
Flag of Czechia image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account

Thanks, Lenny, I didn't felt offended, it mostly happens the other way around in this section, questioners not returning to questions, so you don't know whether a solution worked.

pcelba, now that you mentioned that page bug I faintly remember another bug for listboxes on pages showing through from pages not being active and I think a workaround involved the UIEnable event of the listboxes.

You might try something seemingly unneccessary like setting this.enabled=.t. in that UIEnable event of the listboxes, even though Enabled is .t. always.

Having a page class pagMover instead of cntMover won't help for the pages that have the mover multiple times, but of course you could put each on a seperate page.

Another idea i have is that you move the cntMover containers out of the pages, but set their visibility in the pageframes activate/deactivate events. So the cntMovers actually float over the pageframe and are not contained in it. That involves a bit of additional logic in the pages activate/deactivate events, but you can stay with the layout.

All the cntMovers would be directly on the form visually above the pageframe, but the pages themselves would be empty. At design time youd see all movers together, but would initially set them visible=.f.

In each page activate you do

* set all movers invisible
* set the mover(s) of the current page visible
Thisform.cntMoverXYZ.visible = .t.

Open in new window

And of course in the form init or by default you set the first page mover container visible.

Bye, Olaf.
The Page containing two mover containers must be replaced by different class, of course.

Interesting idea with cntMovers outside the page! But I am not sure what was the problem. If it was "ListBox in a Container on a Page" or just a "ListBox in a Container"... and I have no time to test additional solutions just now.

The UIEnable is definitely not necessary in this case but you are right - it is necessary to use it sometimes.