Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Refresh not refreshing
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00510014
Message ID:
00510365
Views:
21
No done that didn't help a bit

>>ok I can't repreduse the error when I take the navigation buttons out of the form following is the add button code, the refresh code and the navigation code
>>
>>and yes I know this is gonna look like kiddie code, but it works
>>if you want more code to try and help me just say
>>
>>**********************************
>>add button, click event
>>
>>THISFORM.ADDMODE = .T.
>>THISFORM.ID_ARRAY (create a array of unique usernames, to prevent duplicates)
>>WITH THISFORM
>>	.ADDMODE = .T.
>>	.editmode = .T.
>>	.setcaption() (set "save" and "cancel" command buttons)
>>	.setenable() (set the enabled and disabled state for objects)
>>>   APPEND BLANK
>>   .REFRESH
>
>>REPLACE START.administrator WITH .F. , ;
>>        START.Purchase_gen WITH .F., ;
>         START.Purchase_rec WITH .F., ;
>>        START.Purchase_mod WITH .F., ;
>>        START.Receipt_mod WITH .F., ;
>>        START.Vendor WITH .F., ;
>>        START.administrator WITH .F., ;
>>        START.Invoice_gen WITH .F., ;
>>        START.Invoice_mod WITH .F.
>>        START.Inventory_add WITH .F., ;
>>        START.Inventory_del WITH .F., ;
>>        START.Inventory_pic WITH .F., ;
>>        START.Adjustments WITH .F., ;
>>        START.Back_comp WITH .F., ;
>>        START.Back_mod WITH .F., ;
>>        START.Return_modi WITH .F., ;
>>        START.Customer WITH .F.
>>.cmb_Group.VALUE = la_group[1,1]
>>lc_enctypt = ''
>>.txtf_name.SETFOCUS() (no code)
>>.REFRESH()
>>*_SCREEN.WINDOWSTATE = 1 (this will make the form look fine)
>>*_SCREEN.WINDOWSTATE = 0 (this will make the form look fine)
>>ENDWITH
>
>>**********************************
>>thisform.refresh code
>>with thisform
>>.LOCKSCREEN = .T.
>>IF .addmode <> .T.
>> lc_enctypt = loTools.decrypt(START.user_id)
>>ENDIF
>>IF .editmode = .F. AND .addmode = .F.
> with .navclass1
>> .cmdtop.ENABLED =.T.
>> .cmdnext.ENABLED =.T.
>> .cmdprior.ENABLED =.T.
>> .cmdbottom.ENABLED =.T.
>> .ENABLED = .T.
>> .ENABLED = .T.
>> .ENABLED = .T.
>> .cmdsearch.ENABLED = .T.
>> .cmdadd.ENABLED = .T.
>> .cmd_pic.ENABLED = .T.
>> endwith
>> IF DELETE()
>> .lbl_delete.CAPTION = 'User deleted'
>> .CMDDELETEREVERT.CAPTION = 'Recall'
>> .CMDDELETEREVERT.TOOLTIPTEXT = 'Recall user.'
>> .CMDEDITSAVE.ENABLED = .F.
>> ELSE
>> .lbl_delete.CAPTION = 'Active user'
>> .CMDDELETEREVERT.CAPTION = 'Delete'
>> .CMDDELETEREVERT.TOOLTIPTEXT = 'Delete user.'
>> .CMDEDITSAVE.ENABLED = .T.
>> ENDIF
>>
>> IF START.Purchase_gen = .T.
>> .chkPurchase_gen.DISABLEDFORECOLOR = RGB(128,0,0)
>> ELSE
>> .chkPurchase_gen.DISABLEDFORECOLOR = RGB(128,128,128)
>> ENDIF
>>
>> IF START.Purchase_rec = .T.
>> .chkPurchase_rec.DISABLEDFORECOLOR = RGB(128,0,0)
>> ELSE
>> .chkPurchase_rec.DISABLEDFORECOLOR = RGB(128,128,128)
>> ENDIF
>>
>> IF START.Purchase_mod = .T.
>> .chkPurchase_mod.DISABLEDFORECOLOR = RGB(128,0,0)
>> ELSE
>> .chkPurchase_mod.DISABLEDFORECOLOR = RGB(128,128,128)
>> ENDIF
>>
>> IF START.Receipt_mod = .T.
>> .chkReceipt_mod.DISABLEDFORECOLOR = RGB(128,0,0)
>> ELSE
>> .chkReceipt_mod.DISABLEDFORECOLOR = RGB(128,128,128)
>> ENDIF
>>
>> IF START.Vendor = .T.
>> .chkVendor.DISABLEDFORECOLOR = RGB(128,0,0)
>> ELSE
>> .chkVendor.DISABLEDFORECOLOR = RGB(128,128,128)
>> ENDIF
>>
>> IF START.Vendorad = .T.
>> .chk_Venad.DISABLEDFORECOLOR = RGB(128,0,0)
>> ELSE
>> .chk_Venad.DISABLEDFORECOLOR = RGB(128,128,128)
>> ENDIF
>>
>> IF START.Administrator = .T.
>> .chkAdministrator.DISABLEDFORECOLOR = RGB(128,0,0)
>> ELSE
>> .chkAdministrator.DISABLEDFORECOLOR = RGB(128,128,128)
>> ENDIF
>>
>> IF START.Invoice_gen = .T.
>> .chkInvoice_gen.DISABLEDFORECOLOR = RGB(128,0,0)
>> ELSE
>> .chkInvoice_gen.DISABLEDFORECOLOR = RGB(128,128,128)
>> ENDIF
>>
>> IF START.Invoice_mod = .T.
>> .chkInvoice_mod.DISABLEDFORECOLOR = RGB(128,0,0)
>> ELSE
>> .chkInvoice_mod.DISABLEDFORECOLOR = RGB(128,128,128)
>> ENDIF
>>
>> IF START.Inventory_add = .T.
>> .chkInventory_add.DISABLEDFORECOLOR = RGB(128,0,0)
>> ELSE
>> .chkInventory_add.DISABLEDFORECOLOR = RGB(128,128,128)
>> ENDIF
>> .... and so on
>> IF START.Inventory_del = .T.
>> .chkInventory_del.DISABLEDFORECOLOR = RGB(128,0,0)
>> ELSE
>> THISFORM.chkInventory_del.DISABLEDFORECOLOR = RGB(128,128,128)
>> ENDIF
>>
>> IF START.Inventory_pic = .T.
>> THISFORM.chkInventory_pic.DISABLEDFORECOLOR = RGB(128,0,0)
>> ELSE
>> THISFORM.chkInventory_pic.DISABLEDFORECOLOR = RGB(128,128,128)
>> ENDIF
>>
>> IF START.Adjustments = .T.
>> THISFORM.chkAdjustments.DISABLEDFORECOLOR = RGB(128,0,0)
>> ELSE
>> THISFORM.chkAdjustments.DISABLEDFORECOLOR = RGB(128,128,128)
>> ENDIF
>>
>> IF START.Back_comp = .T.
>> THISFORM.chkBack_comp.DISABLEDFORECOLOR = RGB(128,0,0)
>> ELSE
>> THISFORM.chkBack_comp.DISABLEDFORECOLOR = RGB(128,128,128)
>> ENDIF
>>
>> IF START.Back_mod = .T.
>> THISFORM.chkBack_mod.DISABLEDFORECOLOR = RGB(128,0,0)
>> ELSE
>> THISFORM.chkBack_mod.DISABLEDFORECOLOR = RGB(128,128,128)
>> ENDIF
>>
>> IF START.Return_modi = .T.
>> THISFORM.chkReturn_modi.DISABLEDFORECOLOR = RGB(128,0,0)
>> ELSE
>> THISFORM.chkReturn_modi.DISABLEDFORECOLOR = RGB(128,128,128)
>> ENDIF
>>
>> IF START.Customer = .T.
>> THISFORM.chkCustomer.DISABLEDFORECOLOR = RGB(128,0,0)
>> ELSE
>> THISFORM.chkCustomer.DISABLEDFORECOLOR = RGB(128,128,128)
>> ENDIF
>>
>>ELSE
>> .cmdreset.ENABLED = .F.
>> .navclass1.cmdtop.ENABLED =.F.
>> .navclass1.cmdnext.ENABLED =.F.
>> .navclass1.cmdprior.ENABLED =.F.
>> .navclass1.cmdbottom.ENABLED =.F.
>> .navclass1.ENABLED = .F.
>> .cmd_exit.ENABLED = .F.
>> .cmdsearch.ENABLED = .F.
>> .cmdadd.ENABLED = .F.
>> .cmd_pic.ENABLED = .F.
>> IF START.Purchase_gen = .T.
>> THISFORM.chkPurchase_gen.FORECOLOR = RGB(255,0,0)
>> ELSE
>> THISFORM.chkPurchase_gen.FORECOLOR = RGB(0,0,0)
>> ENDIF
>>
>> IF START.Purchase_rec = .T.
>> THISFORM.chkPurchase_rec.FORECOLOR = RGB(255,0,0)
>> ELSE
>> THISFORM.chkPurchase_rec.FORECOLOR = RGB(0,0,0)
>> ENDIF
>>
>> IF START.Purchase_mod = .T.
>> THISFORM.chkPurchase_mod.FORECOLOR = RGB(255,0,0)
>> ELSE
>> THISFORM.chkPurchase_mod.FORECOLOR = RGB(0,0,0)
>> ENDIF
>>
>> IF START.Receipt_mod = .T.
>> THISFORM.chkReceipt_mod.FORECOLOR = RGB(255,0,0)
>> ELSE
>> THISFORM.chkReceipt_mod.FORECOLOR = RGB(0,0,0)
>> ENDIF
>>
>> IF START.Vendor = .T.
>> THISFORM.chkVendor.FORECOLOR = RGB(255,0,0)
>> ELSE
>> THISFORM.chkVendor.FORECOLOR = RGB(0,0,0)
>> ENDIF
>>
>> IF START.Vendorad = .T.
>> THISFORM.chk_Venad.FORECOLOR = RGB(255,0,0)
>> ELSE
>> THISFORM.chk_Venad.FORECOLOR = RGB(0,0,0)
>> ENDIF
>>
>> IF START.Administrator = .T.
>> THISFORM.chkAdministrator.FORECOLOR = RGB(255,0,0)
>> ELSE
>> THISFORM.chkAdministrator.FORECOLOR = RGB(0,0,0)
>> ENDIF
>>
>> IF START.Invoice_gen = .T.
>> THISFORM.chkInvoice_gen.FORECOLOR = RGB(255,0,0)
>> ELSE
>> THISFORM.chkInvoice_gen.FORECOLOR = RGB(0,0,0)
>> ENDIF
>>
>> IF START.Invoice_mod = .T.
>> THISFORM.chkInvoice_mod.FORECOLOR = RGB(255,0,0)
>> ELSE
>> THISFORM.chkInvoice_mod.FORECOLOR = RGB(0,0,0)
>> ENDIF
>>
>> IF START.Inventory_add = .T.
>> THISFORM.chkInventory_add.FORECOLOR = RGB(255,0,0)
>> ELSE
>> THISFORM.chkInventory_add.FORECOLOR = RGB(0,0,0)
>> ENDIF
>>
>> IF START.Inventory_del = .T.
>> THISFORM.chkInventory_del.FORECOLOR = RGB(255,0,0)
>> ELSE
>> THISFORM.chkInventory_del.FORECOLOR = RGB(0,0,0)
>> ENDIF
>>
>> IF START.Inventory_pic = .T.
>> THISFORM.chkInventory_pic.FORECOLOR = RGB(255,0,0)
>> ELSE
>> THISFORM.chkInventory_pic.FORECOLOR = RGB(0,0,0)
>> ENDIF
>>
>> IF START.Adjustments = .T.
>> THISFORM.chkAdjustments.FORECOLOR = RGB(255,0,0)
>> ELSE
>> THISFORM.chkAdjustments.FORECOLOR = RGB(0,0,0)
>> ENDIF
>>
>> IF START.Back_comp = .T.
>> THISFORM.chkBack_comp.FORECOLOR = RGB(255,0,0)
>> ELSE
>> THISFORM.chkBack_comp.FORECOLOR = RGB(0,0,0)
>> ENDIF
>>
>> IF START.Back_mod = .T.
>> THISFORM.chkBack_mod.FORECOLOR = RGB(255,0,0)
>> ELSE
>> THISFORM.chkBack_mod.FORECOLOR = RGB(0,0,0)
>> ENDIF
>>
>> IF START.Return_modi = .T.
>> THISFORM.chkReturn_modi.FORECOLOR = RGB(255,0,0)
>> ELSE
>> THISFORM.chkReturn_modi.FORECOLOR = RGB(0,0,0)
>> ENDIF
>>
>> IF START.Customer = .T.
>> THISFORM.chkCustomer.FORECOLOR = RGB(255,0,0)
>> ELSE
>> THISFORM.chkCustomer.FORECOLOR = RGB(0,0,0)
>> ENDIF
>>ENDIF
>>
>>WITH THISFORM
>> .cmd_invoice.ENABLED = .editmode
>> .cmd_inventory.ENABLED = .editmode
>> .cmd_purchase.ENABLED = .editmode
>> .cmd_back_order.ENABLED = .editmode
>> .chkLogged_in.ENABLED = .F.
>>ENDWITH
>>IF START.logged_in = .T.
>> THISFORM.chkLogged_in.CAPTION = 'Logged in'
>>ELSE
>> THISFORM.chkLogged_in.CAPTION = 'Logged out'
>>ENDIF
>>_SCREEN.MOUSEPOINTER=0
>>_SCREEN.LOCKSCREEN = .F.
>endwith
>
>
>>**********************************
>>nav button code from container class
>>
>>?? CHR(7)  && ring the bell
>>WITH THISFORM
>>	.NAVCLASS1.CMDTOP.ENABLED = .T.
>>	.NAVCLASS1.CMDPRIOR.ENABLED = .t.
>>
>>IF NOT EOF()
>>	SKIP
>>ENDIF
>>		
>>IF EOF()
>>	GO BOTTOM
>>	WAIT "Bottom of the table" window nowait
>>		.NAVCLASS1.cmdbottom.enabled = .f.
>>		.NAVCLASS1.cmdnext.enabled = .f.
>>	>else
>>		.NAVCLASS1.cmdbottom.enabled = .t.
>>		.NAVCLASS1.cmdnext.enabled = .t.
>>	
>>ENDIF		
>.Refresh
>endwith	
>>
>
>Hi Stephen,
>
>I made couple of modifications to increase readability. First of all, use PRE tags to show code properly in UT.
>
>Secondly, you can use with endwith construction once at the top through bottom, no need to do it multiple times...
>
>Finally, you better to overhead the Refresh with all this code. See, if it could be a custom form method, which you can call instead of Refresh. Check Documents section here "Do and don'ts, you'll see this as one of John Koziol's advice: not put lots of code in form refresh).
>
>HTH
Stephen McLaughlin
"Sexy Steve Valenteno", "Blastmaster"
stephenmclaughlin@gmail.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform