Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Weird Refresh Problem 1

Status
Not open for further replies.

Dazb75

Programmer
Aug 14, 2002
10
0
0
GB
I have a form with a pageframe with two pages. On page 2 I have a checkbox, which in the interactivechange event, if the value = 0 a form revert is called (by calling the click event of the revert button).

As part of the revert, page 1 is made the active page. But as the revert is called from the checkbox, an image of the (now disabled) checkbox is appearing temporarily on page 1!

I called a refresh form and refresh of page 1, to no avail.

Any ideas?

Daz
 
Daz,

What do you mean by 'an image of the (now disabled) checkbox'? Do you mean the checkbox itself is on page 1? If not, what sort of 'image'? Also, in what way is this 'temporary'?

Are you sure the checkbox is actually on the pageframe? Could it be that you dropped it on the form? If so, that might explain the behaviour you are seeing.

You can check that by opening the object list at the top of the property window. That will show whether the form itself or a page of the pageframe is the parent container of the checkbox.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Thanks for replying.

The checkbox is definitely on page 2. It's just an image of the checkbox overlapping items on page 1. When I click page 2 after this and then back on page 1, it disappears!
 
It may be some type of video display issue with your monitor, or something goofy like that.

What you may try as a work around is to put the checkbox on top of a container. I suspect the container will not bleed through on Page 1.

Jim Osieczonek
Delta Business Group, LLC
 
Daz,

I think Jim's right about it being a video driver issue. Is the problem specific to one computer? Have you tried running it on a different machine (if possible, under a different version of Windows)? That would at least tell you if it is a hardware/system problem or a VFP issue.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Just a thought.

Try setting thisform.lockscreen = .t. inside of the checkbox's method call and then setting it back.

i.e.
[tt]
Procedure INTERACTIVECHANGE
* Pre condition test code...

If THIS.VALUE==0
Thisform.LOCKSCREEN=.T.
Thisform.cmdRevert.CLICK()
Thisform.LOCKSCREEN=.F.
Endif

* Post condition test code...
Endproc
[/tt]
 
Just recreated your issue on a form. I get the same problem.

When I place the code in the click() event I don't.

Nice little anomaly...

Darrell

Code:
Local oForm
oForm = CREATEOBJECT("clsBleedingCheckBox")
oForm.SHOW()
Read EVENTS

Define CLASS clsBleedingCheckBox AS FORM
  DoCreate = .T.
  AutoCenter = .T.
  Caption = "Bleeding and Non-bleeding checkboxes"

  Add OBJECT pgfMain AS clsPageFrame WITH;
    PAGECOUNT = 2, ;
    LEFT = 10, ;
    TOP = 10, ;
    WIDTH = THIS.WIDTH - 20, ;
    HEIGHT = THIS.HEIGHT - 60

  Add OBJECT cmdRevert AS COMMANDBUTTON WITH;
    CAPTION = "Revert", ;
    LEFT = 10, ;
    TOP = THIS.pgfMain.TOP+THIS.pgfMain.HEIGHT + 10, ;
    AUTOSIZE = .T.

  Procedure DESTROY
    Clear EVENTS
  Endproc

  Procedure cmdRevert.CLICK
    Thisform.pgfMain.ACTIVEPAGE = 1
  Endproc

Enddefine

Define CLASS clsPageFrame AS PAGEFRAME
  PageCount = 2
  page1.CAPTION = "Main Page"
  page2.CAPTION = "Page with checkboxes"

  Procedure page2.INIT
    With THIS
      .ADDOBJECT("chkBleed","clsChkBleed")
      .ADDOBJECT("chkNoBleed","clsChkNoBleed")
    Endwith
  Endproc
Enddefine

Define CLASS clsChkBleed AS CHECKBOX
  Caption = "Bleeds through"
  AutoSize = .T.
  Top = 10
  Left = 10
  Visible = .t.

  Procedure INTERACTIVECHANGE
    * Pre test condition code...
    If THIS.VALUE == 0
      Thisform.cmdRevert.CLICK
    Endif
    * Post test condition code...
  Endproc
Enddefine

Define CLASS clsChkNoBleed AS CHECKBOX
  Caption = "Doesn't bleed through"
  AutoSize = .T.
  Top = 40
  Left = 10
  Visible = .t.

  Procedure CLICK
    * Pre test condition code...
    If THIS.VALUE == 0
      Thisform.cmdRevert.CLICK
    Endif
    * Post test condition code...
  Endproc
Enddefine
 
Darrell and Daz,

Looks like you guys have found a bug. Darrell's code (and fix) produce the same behaviour that you are seeing. I tested it with VFP 6.0, 7.0 and 8.0, all under Windows 98.

I take back what I said about it being a video driver problem.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Concur. It took me several clicks all around the form / checkbox, but I finally emulated the undesireable behavior.

I tested using XP Pro and VFP8

Jim Osieczonek
Delta Business Group, LLC
 
At first I thought it might be a "Themes" thing under VFP 8.0, but it works the same with ThisForm.Themes = .T. or .F.

I'll report this to the VFP team Daz and I'll use your code Darrell if you two don't mind.

Rick
 
Darrell,

It seems that what's also important to reproduce this is that you click on the label for the checkbox. The problem doesn't occur when you click on the box itself.


-BP (Barbara Peisch)
 
Just got back to this today ... many thanks for all your help. I moved the code from the interactivechange event to the valid event. It seems to have cured the problem.

It is possibly a bug ... maybe it has something to do with when VFP redraws the checkbox as disabled. Possibly with the valid event, the code only fires after this.

My code for info ...

If This.Value = 1
If Thisform.editmode
This.Parent.container1.SetAll("Enabled", .T.)
Endif
Endif
Else
If Thisform.editmode
This.Parent.container1.SetAll("Enabled", .F.)
Thisform.horztoolbar1.cmdRestore.Click
Endif
Endif
 
As I undestood the page 1 is not active ( unload) and the image disappears ( maybe your browser doesn´t cache images).
However, is there any help if you activate the page with
opener.show.images?
 
3142,

maybe your browser doesn´t cache images

This is not a browser issue. We are talking about VFP forms here. Also, it has nothing to do with images. What Daz was describing was the checkbox itself appearing on the wrong page.

Mike



Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Thanks for the star Jim.

In addition, I don't think the issue is actually a bug,
but the way the InteractiveChange() event may work.

I'm unsure, but I think while the InteractiveChange() event
is firing within a control and it calls on another method,
any processing performed by the other method when complete,
just returns control to the InteractiveChange() event and
VFP continues awaiting further input to process.

Because of this the control still has the focus and
because it's awaiting further input, it still shows
on the form/page.

Because the page it's contained on is no longer active,
the system cannot process keystrokes/mouseclicks for
that control.

Just a stab in the dark.

Darrell
 
Sounds logical, but your efforts were certainly worthy of recognition.

Besides - I have to make sure I maintain my goal of giving more stars than I receive.

Jim Osieczonek
Delta Business Group, LLC
 
Darrell,

Your explanation is very plausible, but in my opinion, it still sounds like a bug .... in the sense that there can't be any circumstances where this behaviour is supposed to occur. It will be interesting to see if Microsoft says anything about it.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top