Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to force an update?
Message
From
20/09/2005 15:23:14
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
01051018
Message ID:
01051424
Views:
6
>>Naomi - Your suggestion solved my problem. Thanks much, I never would have got that one by myself.
>>
>>- Don
>>
>You're welcome <g> And you even didn't show us your code <g>

I didn't provide the code mostly because I'm lazy and the explanation is long but for those of you who were/are interested here it is.

First of all the controls are all on a page in a pageframe. There are 2 listboxes, an optiongroup, some labels, and a couple of buttons. Neither listbox is linked directly to any data, both are populated via code in a custom method 'populatethis'.

lstCommittees contains a listing of various committees within the organization. Once populated, its contents do not change. The value property of the listbox points to a table containing the members (people) who belong to the selected committee. Interactivechange sets the controlsource of the optiongroup to a field in the table for the selected committee.

Here's the code:
*** lstCommittee1.InteractiveChange

if used('committeefile')
use in committeefile
endif

select mailtags
locate for filename = this.value
gTAGOwner = owner
local lccommitteefile
lccommitteefile = addbs(fileloc) + this.value
use &lccommitteefile in 0 alias committeefile
sele committeefile
set order to tag personID

sele maillist
set rela to personID into committeefile

this.parent.optTAG.controlsource = "committeefile.persontag"
this.parent.optTAG.refresh

this.Parent.lblOwner.refresh
this.Parent.cmdAdd.Refresh
this.Parent.cmdDrop.refresh

dodefault()
The option group shows the position of the current person within the committee structure. That is whether they are a member or an alternate, etc.

Interactivechange in the optiongroup, being linked to the committee table via the listbox, changes the person's status within the committee and calls the refresh method 'populatethis' for the second listbox. This second listbox contains all of the committee assignments for the current person. That is, all the committees he belongs to and the assignment within each of the committees.

Here's the code for the optiongroup which now works fine:
** optTAGS.interactivechange
this.Value = this.value
dodefault()
this.parent.lstTAGs.refresh
and here's the code for the second listbox:
*** lstTAGS.refresh
this.populatethis

*** lstTAGS.populatethis
local lcThistag, lcTestfile
this.clear
sele mailtags
go top
scan
	lctestfile = addbs(fileloc) + allt(mailtags.filename)
	if used('commfile')
	use in commfile
	endif
	use &lctestfile in 0 alias commfile again
	select commfile
	loca for commfile.personid = maillist.personid
	if found()
		do case
		case commfile.persontag = 1
			lcThistag = "Member"
		case commfile.persontag = 2
			lcThistag = "Steering"
		case commfile.persontag = 3
			lcThistag = "Staff"
		case commfile.persontag = 4
			lcThistag = "Courtesy"
		case commfile.persontag = 5
			lcThistag = "Subscriber"
		case commfile.persontag = 6
			lcThistag = "Alternate"
		case commfile.persontag = 7
			lcThistag = "Option7"
		case commfile.persontag = 8
			lcThistag = "Option8"
		case commfile.persontag = 9
			lcThistag = "Option9"
		endcase
		this.additem(allt(mailtags.name) + " - " + lcThistag)
	endif
	sele mailtags
endscan
use in commfile
sele maillist
Without the fix suggested by Naomi the value for the committee assignment that resulted in the second listbox was always one change behind the current setting of the optiongroup. With her fix it works fine.

Thanks for all of your help on this one. It's been a problem for a long time that I previously had a rather clumsey workaround.
Previous
Reply
Map
View

Click here to load this message in the networking platform