Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Intermittent control source not storing
Message
From
27/06/2005 14:03:58
 
 
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01026692
Message ID:
01026788
Views:
16
I believe it may be, except that in this case it happens after the user did the following:

1. Enter text in textbox on page1
2. Click on page2 tab
3. Enter text in textbox on page2
4. Click on save button on toolbar.

Now when the focus is switched in step 2 above, then the valid should have fired and the control lost focus so the variable in the controlsource of the textbox on page1 should have the value entered in the textbox in step1 above, right? Even if the cursor never left the textbox until the user started typing in the textbox on page2 (in step3 above)...

>Isn't this the same problem as a toolbar in general never receives the focus, so that your control never "leaves" so it hasn't done anything to store the change? You have to force your control to lose focus, so the LostFocus and/or Valid will kick in and store the value.
>
>>The code below demonstrates the general layout. A form with a pageframe and 6 pages. The only difference is in our app the save and close button are on an activex object toolbar (dbiTech toolbar). This occurs intermittently, but the user always follows the same steps when it happens and when it doesn't.
>>
>>The user will launch the form, key something into text1 on page1 and then not press enter or tab but while the cursor is still residing in the textbox on page1 click on page2 with the mouse. There are other controls on page1 but they are filled by default and the user does not have to tab through them unless they need to change the values. After the user enters the value into the textbox on page1, as mentioned, the user does not leave the control but clicks on the tab for the next page. Then the user continues on completing all fields on all pages and finally clicks on a save button on the toolbar. The value is not stored in the variable that is the controlsource for text1 on page1 for some reason. It does not happen everytime. To workaround the problem, I am storing the value to the variable in the interactivechange event which seems to work the majority of the time. The variable exists before the form is loaded and is set as the control source for the textbox on page1.
>>
>>Note, the form is actually called via:
>>
>>DO FORM appscrn NAME oappscrn LINKED
>>
>>but to demonstrate a similar layout for testing I created the code below.
>>
>>
>>CLEAR
>>CLOSE ALL
>>set talk OFF
>>set confirm ON
>>set NOTIFY on
>>set status bar ON
>>
>>llcontinue = .T.
>>cvalue = ''
>>cvalue1 = ''
>>cvalue2 = ''
>>cvalue3 = ''
>>cvalue4 = ''
>>cvalue5 = ''
>>cvalue6 = ''
>>
>>oform = CREATEOBJECT('TESTFORM')
>>WITH oform.pageframe1.page1
>> .AddObject('text1','Textbox')
>>ENDWITH
>>WITH oform.pageframe1.page1.text1
>>   .visible = .T.
>>   .controlsource = 'cvalue'
>>   .top = 20
>>   .left = 125
>>   .height = 23
>>   .width = 100
>>ENDWITH
>>WITH oform.pageframe1.page2
>> .AddObject('text2','Textbox')
>>ENDWITH
>>WITH oform.pageframe1.page2.text2
>>   .visible = .T.
>>   .controlsource = 'cvalue2'
>>   .top = 20
>>   .left = 125
>>   .height = 23
>>   .width = 100
>>ENDWITH
>>WITH oform.pageframe1.page3
>> .AddObject('text3','Textbox')
>>ENDWITH
>>WITH oform.pageframe1.page3.text3
>>   .visible = .T.
>>   .controlsource = 'cvalue3'
>>   .top = 20
>>   .left = 125
>>   .height = 23
>>   .width = 100
>>ENDWITH
>>
>>oform.show()
>>
>>DO WHILE llcontinue
>>   READ EVENTS
>>ENDDO
>>
>>oform = null
>>RELEASE oform
>>
>>return
>>
>>
>>DEFINE CLASS testform AS form
>>
>>
>>   Top = 0
>>   Left = 0
>>   Height = 250
>>   Width = 494
>>   DoCreate = .T.
>>   Caption = "Test Form"
>>   Name = "Form1"
>>
>>
>>   ADD OBJECT pageframe1 AS pageframe WITH ;
>>      ErasePage = .T., ;
>>      PageCount = 6, ;
>>      Top = 12, ;
>>      Left = 24, ;
>>      Width = 444, ;
>>      Height = 204, ;
>>      Name = "Pageframe1", ;
>>      Page1.Caption = "Page1", ;
>>      Page1.Name = "Page1", ;
>>      Page2.Caption = "Page2", ;
>>      Page2.Name = "Page2", ;
>>      Page3.Caption = "Page3", ;
>>      Page3.Name = "Page3", ;
>>      Page4.Caption = "Page4", ;
>>      Page4.Name = "Page4", ;
>>      Page5.Caption = "Page5", ;
>>      Page5.Name = "Page5", ;
>>      Page6.Caption = "Page6", ;
>>      Page6.Name = "Page6"
>>
>>   ADD OBJECT command1 AS commandbutton WITH ;
>>      Top = 219, ;
>>      Left = 204, ;
>>      Height = 27, ;
>>      Width = 84, ;
>>      Caption = "Close", ;
>>      Name = "Command1"
>>
>>   PROCEDURE command1.Click
>>      wait WINDOW "cvalue = " + cvalue && this displays the entered value in my testing but not at the user's site
>>      thisform.release()
>>   ENDPROC
>>
>>   PROCEDURE destroy
>>      CLEAR EVENTS
>>      llcontinue = .F.
>>   ENDPROC
>>
>>ENDDEFINE
>>
>>
>>Is this happening to anyone else? Any ideas? I cannot make it happen on my system but I have watched it happen on the user's system.
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform