06301247.txt 30-Jun-00


Subject: Forcing a Browser refresh?
From: "Martyn Fisher" <MartynFisher@csi.com>

Anyone offer help on how to force a Browser in a subdata
  window to refresh after using a form window to edit the
  data?
I can see from the SouthSeas example prog that a Broadcast
  message / receive broadcast message is used. However, I
  think this is over complicated for what I was trying to
  do. From the code below how would I issue a Refresh to the
  <MyWindow1> subdata window <picker1> Browser from the
  OkButton Method of my <EditHeader> window as below. There
  must be a simple way, everything I try ends up as an error
  code 16 at run time. Can't seem to get my head around
  calling Methods of another class.
METHOD EditButton CLASS MyWindow1
  LOCAL oEditHeader AS EditHeader
  SetExclusive(FALSE)
  oEditHeader := EditHeader{ SELF:OWNER }
  oEditHeader:Setup( oSFPicker1:Server:Recno ):Show()
RETURN SELF
METHOD Setup( nRecno ) CLASS EditHeader
  SELF:Goto( nRecno )
RETURN SELF
METHOD OkButton CLASS EditHeader
  SELF:Server:Commit()
  // call the MyWindow1 SubData Picker1 Browsers Refresh()?
  // But can't figure the syntax???
  SELF:EndWindow()
RETURN SELF

Many thanks .
Martyn


Subject: Re: Forcing a Browser refresh?
From: "Geoff Schaller" <geoffsch@bigpond.net.au>

I'm sure I saw this post before and I'm sure I answered it
  ????
Anyhow:
>
// call the MyWindow1 SubData Picker1 Browsers Refresh()?
  But can't figure
>
Yes
SELF:MySubDataWindow:Browser:Refresh()

Geoff


Subject: Re: Forcing a Browser refresh?
From: "Martyn Fisher" <MartynFisher@csi.com>

That does not work Geoff.
If I code
MyWindow1:Picker1:Browser:Refresh()
when I built the error browser tells me that entity
  MyWindow1 cannot be used as a variable.

If I code
SELF:Picker1:Browser:Refresh()
when I build the error browser tells me that Picker1 is not
  a method of EditHeader
the OkButton Method I'm calling from is not a Method of
  MyWindow1 (the main data window) or Picker1 (the subdata
  window) It's a method of a third data window called
  EditHeader used to edit the data from the same database as
  displayed in the browser of the subdata window PICKER1.
  Here's the code again:-
METHOD EditButton CLASS MyWindow1
  LOCAL oEditHeader AS EditHeader
  SetExclusive(FALSE)
  oEditHeader := EditHeader{ SELF:OWNER }
  oEditHeader:Setup( oSFPicker1:Server:Recno ):Show()
RETURN SELF
METHOD Setup( nRecno ) CLASS EditHeader
  SELF:Goto( nRecno )
RETURN SELF
METHOD OkButton CLASS EditHeader
  SELF:Server:Commit()
  // call the MyWindow1 SubData Picker1 Browsers Refresh()?
  SELF:EndWindow()
RETURN SELF
Driving me mad!!!
Time to buy Visual Basic <g>

Martyn


Subject: Re: Forcing a Browser refresh?
From: "Geoff Schaller" <geoffsch@bigpond.net.au>

Martyn,

It does work - we just need to see your code in order to
  determine the class hierarchy. I also presume you are
  using VO 2.5a?  Anyway, put the relevant two Init()
  methods here and we can resolve this for you. It
  definitely does work because we use it everywhere.

Geoff


Subject: Re: Forcing a Browser refresh?
From: "Martyn Fisher" <MartynFisher@csi.com>

okay ... thanks mate - here is:-
METHOD Init(oWindow,iCtlID,oServer,uExtra) CLASS MyWindow1
  LOCAL DIM aFonts[1] AS OBJECT
  SELF:PreInit(oWindow,iCtlID,oServer,uExtra)
  LoadLibrary(String2Psz("RICHED32.DLL"))
  SUPER:Init(oWindow,;
    ResourceID{"MyWindow1",_GetInst()},iCtlID)
  aFonts[1] := Font{,12,"MS Sans Serif"}
  oDCShape1 := GroupBox{SELF,;
    ResourceID{MYWINDOW1_SHAPE1,_GetInst()}}
  oDCShape1:HyperLabel :=HyperLabel{#Shape1, ;
    NULL_STRING,NULL_STRING,NULL_STRING}
  oDCFixedText1 := FixedText{SELF, ;

    ResourceID{MYWINDOW1_FIXEDTEXT1,_GetInst()}}
  oDCFixedText1:HyperLabel := HyperLabel{#FixedText1,;
    "Select the Race Card Below",NULL_STRING,NULL_STRING}
  oDCFixedText1:Font(aFonts[1], FALSE)
  oDCRaceWindow := RichEdit{SELF, ;
    ResourceID{MYWINDOW1_RACEWINDOW,_GetInst()}}
  oDCRaceWindow:HyperLabel := HyperLabel{#RaceWindow,;
    "No Race Card selected...",NULL_STRING,NULL_STRING}
  oCCPushButton1 :=PushButton{SELF,;
    ResourceID{MYWINDOW1_PUSHBUTTON1,_GetInst()}}
  oCCPushButton1:HyperLabel :=HyperLabel{#PushButton1,;
    _chr(38)+"Close",NULL_STRING,NULL_STRING}
  oCCPushButton2 :=PushButton{SELF,;
    ResourceID{MYWINDOW1_PUSHBUTTON2,_GetInst()}}
  oCCPushButton2:HyperLabel := HyperLabel{#PushButton2,;
    _chr(38)+"View the selected Race Card",;
    NULL_STRING,NULL_STRING}
  oCCPushButton3 :=PushButton{SELF,;
    ResourceID{MYWINDOW1_PUSHBUTTON3,_GetInst()}}
  oCCPushButton3:HyperLabel := HyperLabel{#PushButton3,;
    _chr(38)+"Print Race Card",NULL_STRING,NULL_STRING}
  oCCPushButton4 :=PushButton{SELF,;
    ResourceID{MYWINDOW1_PUSHBUTTON4,_GetInst()}}
  oCCPushButton4:HyperLabel := HyperLabel{#PushButton4,;
    _chr(38)+"Edit Race Details",NULL_STRING,NULL_STRING}
  SELF:Caption := "DataWindow Caption"
  SELF:HyperLabel := HyperLabel{#MyWindow1,;
    "DataWindow Caption",NULL_STRING,NULL_STRING}
  SELF:Menu := StandardShellMenu{}
  IF (oServer = NIL)
    SELF:Use(Pick2{})
  ELSE
    SELF:Use(oServer)
  ENDIF
  oSFPicker1 := Picker1{SELF,MYWINDOW1_PICKER1}
  oSFPicker1:show()
  SELF:PostInit(oWindow,iCtlID,oServer,uExtra)
RETURN SELF
METHOD Init(oWindow,iCtlID,oServer,uExtra) CLASS Picker1
  SELF:PreInit(oWindow,iCtlID,oServer,uExtra)
  SUPER:Init(oWindow,;
    ResourceID{"Picker1",_GetInst()},iCtlID)
  SELF:Caption := "Select Race"
  SELF:HyperLabel := HyperLabel{#Picker1,;
    "Select Race",NULL_STRING,NULL_STRING}
  IF (oServer = NIL)
    SELF:Use(Pick1{})
  ELSE
    SELF:Use(oServer)
  ENDIF
  SELF:Browser := MyDataBrowser{SELF}
  SELF:Browser:Font := Font{,2,"MS Sans Serif"}
  oDBRACEDATE := DataColumn{Pick1_RACEDATE{}}
  oDBRACEDATE:Width := 10
  oDBRACEDATE:HyperLabel := HyperLabel{#RACEDATE,;
    "Date",NULL_STRING,"Pick1_RACEDATE"}
  oDBRACEDATE:Caption := "Date"
  SELF:Browser:AddColumn(oDBRACEDATE)
  oDBMEETING := DataColumn{Pick1_MEETING{}}
  oDBMEETING:Width := 19

  oDBMEETING:HyperLabel := HyperLabel{#MEETING,;
    "Meeting",NULL_STRING,"Pick1_MEETING"}
  oDBMEETING:Caption := "Meeting"
  SELF:Browser:AddColumn(oDBMEETING)
  oDBRACETIME := DataColumn{Pick1_RACETIME{}}
  oDBRACETIME:Width := 7
  oDBRACETIME:HyperLabel :=
  HyperLabel{#RACETIME,"Time",NULL_STRING,"Pick1_RACETIME"}
  oDBRACETIME:Caption := "Time"
  self:Browser:AddColumn(oDBRACETIME)
  self:ViewAs(#BrowseView)
  self:PostInit(oWindow,iCtlID,oServer,uExtra)
return self
METHOD Init(oWindow,iCtlID,oServer,uExtra) CLASS EditHeader
  SELF:PreInit(oWindow,iCtlID,oServer,uExtra)
  SUPER:Init(oWindow,;
    ResourceID{"EditHeader",_GetInst()},iCtlID)
  oDCSC_RACEDATE := FixedText{SELF,;
    ResourceID{EDITHEADER_SC_RACEDATE,_GetInst()}}
  oDCSC_RACEDATE:HyperLabel := HyperLabel{#SC_RACEDATE,;
    "Racedate:",NULL_STRING,NULL_STRING}
  oDCSC_MEETING := FixedText{SELF,;
    ResourceID{EDITHEADER_SC_MEETING,_GetInst()}}
  oDCSC_MEETING:HyperLabel := HyperLabel{#SC_MEETING,;
    "Meeting:",NULL_STRING,NULL_STRING}
  oDCSC_RACETIME := FixedText{SELF,;
    ResourceID{EDITHEADER_SC_RACETIME,_GetInst()}}
  oDCSC_RACETIME:HyperLabel := HyperLabel{#SC_RACETIME,;
    "Racetime:",NULL_STRING,NULL_STRING}
  oDCSC_RACETITLE := FixedText{SELF,;
    ResourceID{EDITHEADER_SC_RACETITLE,_GetInst()}}
  oDCSC_RACETITLE:HyperLabel := HyperLabel{#SC_RACETITLE,;
    "Racetitle:",NULL_STRING,NULL_STRING}
  oDCSC_GOING := FixedText{SELF,;
    ResourceID{EDITHEADER_SC_GOING,_GetInst()}}
  oDCSC_GOING:HyperLabel := HyperLabel{#SC_GOING,;
    "Going:",NULL_STRING,NULL_STRING}
  oDCSC_DISTANCE := FixedText{SELF,;
    ResourceID{EDITHEADER_SC_DISTANCE,_GetInst()}}
  oDCSC_DISTANCE:HyperLabel := HyperLabel{#SC_DISTANCE,;
    "Distance:",NULL_STRING,NULL_STRING}
  oDCSC_RUNNERS := FixedText{SELF,;
    ResourceID{EDITHEADER_SC_RUNNERS,_GetInst()}}
  oDCSC_RUNNERS:HyperLabel := HyperLabel{#SC_RUNNERS,;
    "Runners:",NULL_STRING,NULL_STRING}
  oDCSC_RACECLASS := FixedText{SELF,;
    ResourceID{EDITHEADER_SC_RACECLASS,_GetInst()}}
  oDCSC_RACECLASS:HyperLabel := HyperLabel{#SC_RACECLASS,;
    "Raceclass:",NULL_STRING,NULL_STRING}
  oDCSC_KEY := FixedText{self,;
    ResourceID{EDITHEADER_SC_KEY,_GetInst()}}
  oDCSC_KEY:HyperLabel := HyperLabel{#SC_KEY,;
    "Key:",NULL_STRING,NULL_STRING}
  oDCRACEDATE := SingleLineEdit{self,;
    ResourceID{EDITHEADER_RACEDATE,_GetInst()}}
  oDCRACEDATE:FieldSpec := Pick1_RACEDATE{}
  oDCRACEDATE:HyperLabel := HyperLabel{#RACEDATE,;
    "Racedate:",NULL_STRING,"Pick1_RACEDATE"}
  oDCMEETING := SingleLineEdit{self,;
    ResourceID{EDITHEADER_MEETING,_GetInst()}}

  oDCMEETING:FieldSpec := Pick1_MEETING{}
  oDCMEETING:HyperLabel := HyperLabel{#MEETING,;
    "Meeting:",NULL_STRING,"Pick1_MEETING"}
  oDCRACETIME := SingleLineEdit{self,;
    ResourceID{EDITHEADER_RACETIME,_GetInst()}}
  oDCRACETIME:FieldSpec := Pick1_RACETIME{}
  oDCRACETIME:HyperLabel := HyperLabel{#RACETIME,;
    "Racetime:",NULL_STRING,"Pick1_RACETIME"}
  oDCRACETITLE := SingleLineEdit{self,;
    ResourceID{EDITHEADER_RACETITLE,_GetInst()}}
  oDCRACETITLE:FieldSpec := Pick1_RACETITLE{}
  oDCRACETITLE:HyperLabel := HyperLabel{#RACETITLE,;
    "Racetitle:",NULL_STRING,"Pick1_RACETITLE"}
  oDCGOING := SingleLineEdit{self,;
    ResourceID{EDITHEADER_GOING,_GetInst()}}
  oDCGOING:FieldSpec := Pick1_GOING{}
  oDCGOING:HyperLabel := HyperLabel{#GOING,;
    "Going:",NULL_STRING,"Pick1_GOING"}
  oDCDISTANCE := SingleLineEdit{self,;
    ResourceID{EDITHEADER_DISTANCE,_GetInst()}}
  oDCDISTANCE:FieldSpec := Pick1_DISTANCE{}
  oDCDISTANCE:HyperLabel := HyperLabel{#DISTANCE,;
    "Distance:",NULL_STRING,"Pick1_DISTANCE"}
  oDCRUNNERS := SingleLineEdit{self,;
    ResourceID{EDITHEADER_RUNNERS,_GetInst()}}
  oDCRUNNERS:FieldSpec := Pick1_RUNNERS{}
  oDCRUNNERS:HyperLabel := HyperLabel{#RUNNERS,;
    "Runners:",NULL_STRING,"Pick1_RUNNERS"}
  oDCRACECLASS := SingleLineEdit{self,;
    ResourceID{EDITHEADER_RACECLASS,_GetInst()}}
  oDCRACECLASS:FieldSpec := Pick1_RACECLASS{}
  oDCRACECLASS:HyperLabel := HyperLabel{#RACECLASS,;
    "Raceclass:",NULL_STRING,"Pick1_RACECLASS"}
  oDCKEY := SingleLineEdit{self,;
    ResourceID{EDITHEADER_KEY,_GetInst()}}
  oDCKEY:FieldSpec := Pick1_KEY{}
  oDCKEY:HyperLabel := HyperLabel{#KEY,;
    "Key:",NULL_STRING,"Pick1_KEY"}
  oCCOkButton := PushButton{self,;
    ResourceID{EDITHEADER_OKBUTTON,_GetInst()}}
  oCCOkButton:HyperLabel := HyperLabel{#OkButton,;
    _chr(38)+"OK",NULL_STRING,NULL_STRING}
  self:Caption := "DataWindow Caption"
  self:HyperLabel := HyperLabel{#EditHeader,;
    "DataWindow Caption",NULL_STRING,NULL_STRING}
  if (oServer = NIL)
    self:Use(Pick1{})
  else
    self:Use(oServer)
  endif
  self:PostInit(oWindow,iCtlID,oServer,uExtra)
return self
METHOD PushButton4 CLASS MyWindow1
  LOCAL oEditHeader AS EditHeader
  SetExclusive(FALSE)
  oEditHeader := EditHeader{ SELF:OWNER }
  oEditHeader:Setup( oSFPicker1:Server:Recno ):Show()
RETURN SELF
hope this is enough

Regards
Martyn


Subject: SV: Forcing a Browser refresh?
From: "Lars-Eric Gisslen" <lars.gisslen@chello.se>

Martyn,

You subform is stored the oSFPicker1 instance variable so
  you have to access it through that variable like
SELF:oSFPicker1:Browser:Refresh()
That should solv your problem with accessing the browser in
  the subform.

Regards,
Lars-Eric


Subject: Re: Forcing a Browser refresh?
From: "Geoff Schaller" <geoffsch@bigpond.net.au>

Wot Lars-Eric said <g>.


Subject: Re: Forcing a Browser refresh?
From: "Martyn Fisher" <MartynFisher@csi.com>

Went the long way around it in the end - like the SSA
  example. Seems to work fine.

Cheers Geoff
Martyn


Subject: Re: Forcing a Browser refresh?
From: "Geoff Schaller" <geoffsch@bigpond.net.au>

<bg>
....but the other is simpler. its just an issue of getting
  the inheritance path right <g>.


Subject: Re: Forcing a Browser refresh?
From: "Martyn Fisher" <MartynFisher@csi.com>

sorry Geoff ... just remembered ... yes VO ver 2.5a
Does that make any difference?

Martyn


Subject: Re: Forcing a Browser refresh?
From: "Geoff Schaller" <geoffsch@bigpond.net.au>

Yes - heaps if you subclass the browser. It generates the
  Init() method differently.


Subject: Re: Forcing a Browser refresh?

From: Uwe Heyer <uweheyer@my-deja.com>

Hi Martyn,

as far as I can see your Class EditHeader don't know
  anything about your MyWindow1. It is not possible to call
  a Method of something unkown or a class directly. You can
  call Methods of instances of Classes
You could advance your Setup Method and you could call it
  e.g.
  oEditHeader:Setup( oSFPicker1:Server:Recno, SELF ):Show()
  METHOD Setup( nRecno, oBrowserOwner ) CLASS EditHeader
  SELF:MyOwner := oBrowserOwner  // Class MyWindow
  SELF:Goto( nRecno )
RETURN SELF
and later
MyOwner:osfPicker1:Refresh()
not tested but should give you an idea of the way to go

Ahoj
-Uwe


Subject: Re: Forcing a Browser refresh?
From: Gryphon_Systems@telus.net (Ed Ratcliffe)

Martyn

I assume from your code snippet that MyWindow1 is the
  browser and EditHeader is a separate edit window that that
  allows editing in form view the current record in the
  brower of MyWindow1. If this is the case then you will
  have to set up some form of message system to notify the
  browser to update its data from the server after the
  commit from your form window. The SSA tutorial uses a
  system which is worth reviewing.

Ed Ratcliffe


Subject: Re: Forcing a Browser refresh?
From: "Martyn Fisher" <MartynFisher@csi.com>

Thanks Ed,

The browser is in a subdata window called Picker1 placed on
  MyWindow1. With a separate window called EditHeader to
  edit the data in a form view.
I've looked at the SSA example and can see what you mean.
  Where a Broadcast Message / Receive Broadcast Message
  system is used. But from what I can see the main shell
  window depends on using a child window array to keep track
  of windows to send a broadcast message to. My app only
  uses 3 windows so I thought this is unnecessary and maybe
  there's a simpler way. I'm still new to VO (ver. 2.5a) and
  windows programming but used Clipper (summer '87 - don't
  laugh) for years. I find getting my head round OOP
  difficult, probably too many bad clipper habits ;o)
So far nothing seems easy with VO and i've never seen such
  vague on line help devoid of any real world examples of

  anything. There's no books available on VO (where would I
  have been with clipper without Rich Spence / Edward Tiley
  / Mueller etc.) I'm starting to question the wisdom of
  plumping for VO and wondering just how many people are
  using it in view of the lack of third party literature.
Looking on the brighter side of things maybe I'll get 'it'
  soon and start producing something more worthwhile.

Regards
Martyn


Subject: Re: Forcing a Browser refresh?
From: Jean-Marie Berthiaume <jiembe@videotron.ca>

You have to pass by the Shell Window which is the owner of
  MyWindow1 and EditHeader. Those 2 windows are not related
  so you can't directly refresh the browser from window to
  the other. EditHeader should call a method of its owner
  (the shellwindow) which will ask is other child window
  (MyWindow1) to ask is own SubDataWindow to refresh its
  browser.

Jean-Marie Berthiaume


Subject: Re: Forcing a Browser refresh?
From: Gryphon_Systems@telus.net (Ed Ratcliffe)

Martyn Fisher

I agree that the supplied help is not somewhat but very
  vague. I also stayed with Clipper until pressure from
  clients got me off my behind.
You are right VO is not easy and sometimes OOP even harder
  but stick with it,  you will get it. The thing to remember
  is that everything in windows is controlled by messages
  passed around in response to events. as Jean has stated
  the only way to get a message to the browser is via the
  common parent. I have an application that has been using
  the same design as you are attempting since VO ver 1.0 and
  have had no problem with a simplified version of the
  messaging system used in the SSA sample. Proper messaging
  becomes even more critical when a user has more than one
  edit form open at a time.

Ed Ratcliffe


Subject: Re: Forcing a Browser refresh?
From: "Martyn Fisher" <MartynFisher@csi.com>

Thanks Ed - i've setup a message system like the SSA
  example. It works fine.
I can see now where I was going wrong, of course there could
  be many windows of the same type open!
maybe, just maybe I'm getting 'it' huh lol

cheers
Martyn



Subject: Re: Forcing a Browser refresh?
From: Duane@altx.net (Duane)

The DataBrowser has a Method called Refresh().
If take a look at the generated code and find the name of
  the SubDataWindow you should be able to do this:
METHOD EditButton CLASS MyWindow1
  LOCAL oEditHeader AS EditHeader
  SetExclusive(FALSE)
  oEditHeader := EditHeader{ SELF:OWNER }
  oEditHeader:Setup( oSFPicker1:Server:Recno ):Show()
  // Just Replace oSubDataWindow with the name of your
  control
  SELF:oSubDataWindow:Browser:Refresh()  // <-----
RETURN SELF


Subject: Re: Forcing a Browser refresh?
From: <MartynFisher@csi.com>

cheers mate ... went the long way round in the end ... set
  up a message system like used in the SSA example

Regards
Martyn
