http://bugs.winehq.org/show_bug.cgi?id=33241
Bug #: 33241 Summary: incorrect display of a combobox in a Clipper application Product: Wine Version: unspecified Platform: x86 OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown AssignedTo: wine-bugs@winehq.org ReportedBy: ironeman@tiscali.it Classification: Unclassified
As mentioned in http://forum.winehq.org/viewtopic.php?f=8&t=18198, I am using 16-bit Clipper/xBase programs. When I have a listbox, the field is not correctly initialized, despite the list is ok. Debugging my application, I have found that it is due to a strange memory management. I start by saying that Clipper/xBase uses dynamic scoping, so the value of a variable is the last assigned to it into the stack; a variable can be local or global (prefixed by m->). When using the dialog that has the problem, I use the activation command (Fivewin library): m->mTipoDoc:=.... // assign the global variable m->mTipoDoc activate DIALOG oDlg centered on init (SettaCombo()) function SettaCombo() // initialization code of the dialog ... // use the global variable m->mTipoDoc but, at this point, when using WINE, the variable has lost its content and is empty
I solved the problem using a local variable that temporarily holds the value of the global variable: m->mTipoDoc:=.... // assign the global variable m->mTipoDoc local tmpcod:=m->mTipoDoc // to solve the wine bug activate DIALOG oDlg centered on init (SettaCombo(tmpcod)) function SettaCombo(val) m->mTipoDoc:=val // to solve the wine bug ... // use the global variable m->mTipoDoc
Evidently the local variable is managed in a different way by WINE and the error has disappered.
To test this behaviour, I wrote the attached sample program. Into the zip there is a readme.pdf that explains how it works. Best regards.