Problems with savebutton template

I am using Clarion 11 with browse/form templates.

The problem I have is that after building the solution, the use variable for the save-button is lost and I have to manually insert into the code and save it. The next time I build the same things happen.
This results in less efficient coding. Anybody else having the same problem?

Also, when I sett the property ‘use visual styles’ to false in the form template, after compiling it defaults back to true. And then I have to change it back. Frustrating. Suggestions?

Something odd with your app somewhere. I use the SaveButton template in a few places and have never seen this behaviour

It may help of you posted some screen captures of before and after so we can see the code

Sorry for the delay in replying.

Below is a copy of thisWindow.Init procedure.

The problem is at the end of the procedure. It shows “SELF.OkControl =” (empty). This means I have to insert the ?usebutton/okbutton manually. In my app this means I have to do it manually for 5-10 windows/forms on every compilation. Frustrating.

+++++

ThisWindow.Init PROCEDURE

ReturnValue BYTE,AUTO

CODE
GlobalErrors.SetProcedureName(‘n_Frm_SHIP’)
SELF.Request = GlobalRequest ! Store the incoming request
ReturnValue = PARENT.Init()
IF ReturnValue THEN RETURN ReturnValue.
SELF.FirstField = ?btnCancelSaveVessel
SELF.VCRRequest &= VCRRequest
SELF.Errors &= GlobalErrors ! Set this windows ErrorManager to the global ErrorManager
CLEAR(GlobalRequest) ! Clear GlobalRequest after storing locally
CLEAR(GlobalResponse)
SELF.AddItem(Toolbar)
SELF.HistoryKey = 734
SELF.AddHistoryFile(vsl:Record,History::vsl:Record)
SELF.AddHistoryField(?vsl:Deadweight,39)
SELF.AddHistoryField(?vsl:Summerdraught,37)
SELF.AddHistoryField(?vsl:Loa,23)
SELF.AddHistoryField(?vsl:DWCC,40)
SELF.AddHistoryField(?vsl:Beam,38)
SELF.AddHistoryField(?vsl:Built,47)
SELF.AddHistoryField(?vsl:Grt,41)
SELF.AddHistoryField(?vsl:Nrt,42)
SELF.AddHistoryField(?vsl:Yard,48)
SELF.AddHistoryField(?vsl:Suezgrt,43)
SELF.AddHistoryField(?vsl:Sueznrt,44)
SELF.AddHistoryField(?vsl:Iceclass,31)
SELF.AddHistoryField(?vsl:Panama,45)
SELF.AddHistoryField(?vsl:Tonnage_Cert,46)
SELF.AddHistoryField(?vsl:Flag,49)
SELF.AddHistoryField(?vsl:Hometown,51)
SELF.AddHistoryField(?vsl:IMONumber,3)
SELF.AddHistoryField(?vsl:MMSI,4)
SELF.AddHistoryField(?vsl:Callsign:3,50)
SELF.AddHistoryField(?vsl:CBM_100_PCT,26)
SELF.AddHistoryField(?vsl:Holds_Tanks,27)
SELF.AddHistoryField(?vsl:Min_Temp,29)
SELF.AddHistoryField(?vsl:Double_bottom,32)
SELF.AddHistoryField(?vsl:SBT,35)
SELF.AddHistoryField(?vsl:Max_SG,30)
SELF.AddHistoryField(?vsl:Double_Side,34)
SELF.AddHistoryField(?vsl:Gear,28)
SELF.AddHistoryField(?vsl:IGS,33)
SELF.AddHistoryField(?vsl:Grain,24)
SELF.AddHistoryField(?vsl:Bale,25)
SELF.AddHistoryField(?vsl:ImoClass,36)
SELF.AddHistoryField(?vsl:Speed_laden,15)
SELF.AddHistoryField(?vsl:Fo_laden,6)
SELF.AddHistoryField(?vsl:Mdo_sea,10)
SELF.AddHistoryField(?vsl:Speed_ballast,16)
SELF.AddHistoryField(?vsl:Fo_ballast,7)
SELF.AddHistoryField(?vsl:Mdo_port,12)
SELF.AddHistoryField(?vsl:Daycost,21)
SELF.AddHistoryField(?vsl:Fueltype,11)
SELF.AddHistoryField(?vsl:Mdo_type,13)
SELF.AddHistoryField(?vsl:Telephone1,52)
SELF.AddHistoryField(?vsl:Telefax,54)
SELF.AddHistoryField(?vsl:Telex1,55)
SELF.AddHistoryField(?vsl:Notes,62)
SELF.AddHistoryField(?vsl:VesselName,5)
SELF.AddUpdateFile(Access:tblvessels2)
Relate:tblvessels2.Open ! File tblvessels2 used by this procedure, so make sure it’s RelationManager is open
SELF.FilesOpened = True
SELF.Primary &= Relate:tblvessels2
IF SELF.Request = ViewRecord AND NOT SELF.BatchProcessing ! Setup actions for ViewOnly Mode
SELF.InsertAction = Insert:None
SELF.DeleteAction = Delete:None
SELF.ChangeAction = Change:None
SELF.CancelAction = Cancel:Cancel
SELF.OkControl = 0
ELSE
SELF.ChangeAction = Change:Caller ! Changes allowed
!======================================================================================================================
SELF.OkControl = |
!My Comment: The save button is not saved and I have to manually insert it into the code. (This Window. Init procedure)
!======================================================================================================================
IF SELF.PrimeUpdate() THEN RETURN Level:Notify.
END
SELF.Open(QuickWindow) ! Open window
Do DefineListboxStyle
Resizer.Init(AppStrategy:Surface,Resize:SetMinSize) ! Controls like list boxes will resize, whilst controls like buttons will move
SELF.AddItem(Resizer) ! Add resizer to window manager
INIMgr.Fetch(‘n_Frm_SHIP’,QuickWindow) ! Restore window settings from non-volatile store
Resizer.Resize ! Reset required after window size altered by INI manager
SELF.AddItem(ToolbarForm)
SELF.SetAlerts()
RETURN ReturnValue

Go into the … button for the Window that shows you the text of of the window.
Go to the OK button and look for the #SEQ(1) entry. I’m guessing that there won’t be one there or if it is there, the number in the parens is wrong.
Use Application -> Selective Export and export the procedure that has the problem. Open the procedure TXA in an editor and search for NAME ABC SaveButton. You’ll find something like this.

[ADDITION]
NAME ABC SaveButton
[INSTANCE]
INSTANCE 2
PROCPROP
[PROMPTS]

The INSTANCE number, in this example 2, is the values that has to be in the #SEQ(2) in your window definition.
Give that a shot and confirm if your #SEQ entries are correct.

1 Like