I have a form that has an A-Z supercontrol (actually there are 3 of them) inside a conditional object. The condition is based on a variable set by a dropdown object that is also based on a variable. The dropdown when changed by the user sets the index for the form for the user to perform a search based on a key field. When I open the form normally, there is a default setting for the dropdown and the variable is set to select the correct A-Z supercontrol in the conditional object which changes appropriately when the user selects a different field to search by. All of this works great - until I went to open the form to a particular record from another form.
I was able to change the dropdown and the index from the calling script, but could not get the conditional object to refresh so it would show the correct supercontrol - which in this particular case was NONE. In one of the threads posted here, I think it was Cal Locklin who suggested pushing a button on the form as the OnPush event would trigger the form changes I needed to get the conditional object to refresh. That at least got me thinking in the right direction, though I didn't want to add a button - even if I made it 'invisible', it would still show on the form. Soooo I used a hotspot instead, and placed it on the default page of the conditional object. I also added a new page where the variable was set to blank to hide the supercontrol. The user never sees the click on the hotspot because the blank condition is set so fast now. And he cannot even hover over it to know that something is there.
After spending most of my day trying to get this to work, I thought somebody else might find it useful.
Normal vs Called
default.pngcalled.png
My udf's Frm_Pop() and Go_Frm() used in these scripts can be imported into the control panel:
myudfs_06292019.txt
EDIT: Just noticed I still have an error to address - notice the column title 'LNAME' (a calculated field) should be ' MEMB_ID' on the called form...I changed the hotspot code above.
I was able to change the dropdown and the index from the calling script, but could not get the conditional object to refresh so it would show the correct supercontrol - which in this particular case was NONE. In one of the threads posted here, I think it was Cal Locklin who suggested pushing a button on the form as the OnPush event would trigger the form changes I needed to get the conditional object to refresh. That at least got me thinking in the right direction, though I didn't want to add a button - even if I made it 'invisible', it would still show on the form. Soooo I used a hotspot instead, and placed it on the default page of the conditional object. I also added a new page where the variable was set to blank to hide the supercontrol. The user never sees the click on the hotspot because the blank condition is set so fast now. And he cannot even hover over it to know that something is there.
After spending most of my day trying to get this to work, I thought somebody else might find it useful.
Normal vs Called
default.pngcalled.png
Code:
dim choice as c = "" dim default as c = "Member Info" dim frmname as c = "" choice = ui_get_list("Open Form",default,"Member Info","Member Data") select case choice = "" 'user cancelled goto ENDIT case choice = "Member Info" frmname = "MembInfo" Frm_Pop(frmname,"MEMB_ID",go_rec,"center","top") case choice = "Member Data" frmname = "MembDetail" Go_Frm(frmname,"MEMB_ID",go_rec) xbasic_wait_for_idle(.15) If MembDetail:b_editok.text = "No Edit" then MembDetail:B_EditOk.push() end if MembDetail:vSearchfor.value = go_rec MembDetail.hotspot1.Push() end select ENDIT: end '***************************************** 'code for Hotspot on called form dim shared btntype as c = "" dim shared vcLookup as c = "Memb_ID" browse1:display.entry.width = 12 topparent:browse1:display.object.column_title = vcLookup btn_cond.refresh() lu_field.refresh() 'this is the object name on the form for the var->vcLookup (Search By field)
myudfs_06292019.txt
EDIT: Just noticed I still have an error to address - notice the column title 'LNAME' (a calculated field) should be ' MEMB_ID' on the called form...I changed the hotspot code above.