FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Problem Upgrading To FWH7.11
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Problem Upgrading To FWH7.11
Posted: Thu Dec 13, 2007 03:43 PM

Acwoo,

FWH Class TGet uses a Harbour Class TGet object, and this Harbour class have been changed lately.

We need you to provide us a reproduceable example, with the error, so we can help you

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 45
Joined: Fri Sep 28, 2007 08:53 AM
Problem Upgrade To FWH7.11
Posted: Fri Dec 14, 2007 03:28 PM

Thanks for your help

A reproduceable example:

include "FiveWin.ch"

static oWnd

function Main()

local oFont
DEFINE FONT oFont NAME "Arial" SIZE 0, -22 BOLD
if !file("tax3.dbf")
createfilea()
indexfile()
endif

DEFINE WINDOW oWnd FROM 1, 1 TO 20, 70 ;
TITLE "Test"

  @ 46, 26 BTNBMP ;
         PROMPT "Test" SIZE 83, 16 NOBORDER ;
         ACTION ( form6x() )

SET MESSAGE OF oWnd ;
TO "WELCOME" CENTERED TIME DATE
ACTIVATE WINDOW oWnd MAXIMIZED

DEFINE FONT oFont NAME "Arial" SIZE 0, -11 BOLD
oFont:End()

return nil


function createfilea()

// "File : tax3.dbf"
tmpdbf:= {}
AAdd(tmpdbf, {"recnum1", "n", 5, 0})
AAdd(tmpdbf, {"recnum", "c", 8, 0})
AAdd(tmpdbf, {"desp", "c", 1000, 0})
dbcreate("tax3.dbf", tmpdbf)
close
// "File : form6.dbf"
tmpdbf:= {}
AAdd(tmpdbf, {"EMPNO", "C", 12, 0})
AAdd(tmpdbf, {"Coynum", "C", 15, 0}) // Company No.
AAdd(tmpdbf, {"Name1", "C", 50, 0}) // Name Of Company
AAdd(tmpdbf, {"AutCap", "n", 15, 2}) // Authorised Capital
AAdd(tmpdbf, {"NumShare", "n", 13, 0}) // Number Of Shares
AAdd(tmpdbf, {"CoySec2", "C", 50, 0}) // Name Of Company Secretary

AAdd(tmpdbf, {"SecondRef", "c", 12, 0}) //Second Reference
dbcreate("form6.dbf", tmpdbf)
close


function form6x()

#include "fivewin.ch"
local oDlg

 if (Select("form6") == 0)
     use form6 new
     set index to form6i
 else
     select Select("form6")
 endif 
 goto top  
 if eof()
    mrefno = space(12)
    goto top
    set filter to
    goto top
    do while !eof()
       xSeconfRef = SecondRef
       if mrefno < XSeconfRef
          mrefno = XSeconfRef
       endif
       select form6
       skip 1
    enddo
        abb = 13
        abbx = len(alltrim(mrefno))
        abby = len(alltrim(mrefno))
        acc = 1
        do while acc <= abbx
           add = substr(mrefno,abbx - 1,1)
           if isdigit(add)
              abbx = abbx - 1
           else
             exit
           endif
           acc = acc + 1
        enddo
        hlastinv = substr(mrefno,abbx,13)
        lastinv = val(hlastinv)
        lastinv = lastinv + 1
        klastinv = str(lastinv)
        lenklastinv = len(alltrim(klastinv))
        kilastinv = "000000000000"
        rlastinv = len(alltrim(klastinv))
        lenfirst = len(substr(mrefno,1,abbx - 1))
        kilastinv = substr(kilastinv,abbx,abby - lenfirst - lenklastinv)
        kkrstr = substr(mrefno,1,abbx - 1)  
        mrefno = kkrstr + kilastinv + alltrim(klastinv)
        mrefno = substr(mrefno + space(12),1,12)
        if mrefno = "1"
          mrefno = "R 000001"
        endif
        mSecondRef = mrefno

       Append Blank
       onerror("APPEND")
       replace empno with "A0001"
       replace SecondRef with mSecondRef
       replace Name1 with "John"
    else
       mSecondRef = SecondRef
    endif
    goto top

DEFINE DIALOG oDlg FROM 0, 0 TO 26, 79 ;
TITLE "Form 6 "

     @ -0.361, -0.1 to 13.945, 44.714
     @ -0.361, -0.1 to 12.545, 44.714

@ 0.2, 0.4 LISTBOX oLbx FIELDS form6->empno,;
form6->Name1 ;
HEADERS "No", "Name" ;
FIELDSIZES 100, 390 ;
SIZE 307, 170 OF oDlg

@ 9.95, 18.7 BUTTON "E&dit" OF oDlg SIZE 40, 12 ;
ACTION (form6new("2"), oLbx:Refresh())
@ 9.95, 25.7 BUTTON "&Exit" OF oDlg SIZE 40, 12 ;
ACTION ( lreturn := .t., oDlg:End())

ACTIVATE DIALOG oDlg CENTERED
close databases
return nil


function form6new()

parameter Newedit

local oDlg
local oFont
local oLbx
local lreturn := .f.
local oc1desp
local time1:= 1
local newref1:= "N"

DEFINE FONT oFont NAME "Arial" SIZE 0, -11 BOLD

  select form6     
  mSecondRef = SecondRef
  if Newedit = "1"
    mrefno = space(12)
    goto top
    set filter to
    goto top
    do while !eof()
       xSeconfRef = SecondRef
       if mrefno < XSeconfRef
          mrefno = XSeconfRef
       endif
       select form6
       skip 1
    enddo
        abb = 13
        abbx = len(alltrim(mrefno))
        abby = len(alltrim(mrefno))
        acc = 1
        do while acc <= abbx
           add = substr(mrefno,abbx - 1,1)
           if isdigit(add)
              abbx = abbx - 1
           else
             exit
           endif
           acc = acc + 1
        enddo
        hlastinv = substr(mrefno,abbx,13)
        lastinv = val(hlastinv)
        lastinv = lastinv + 1
        klastinv = str(lastinv)
        lenklastinv = len(alltrim(klastinv))
        kilastinv = "000000000000"
        rlastinv = len(alltrim(klastinv))
        lenfirst = len(substr(mrefno,1,abbx - 1))
        kilastinv = substr(kilastinv,abbx,abby - lenfirst - lenklastinv)
        kkrstr = substr(mrefno,1,abbx - 1)  
        mrefno = kkrstr + kilastinv + alltrim(klastinv)
        mrefno = substr(mrefno + space(12),1,12)
        if mrefno = "1"
          mrefno = "R 000001"
        endif
        mSecondRef = mrefno
        set filter to empno = mempnox
         newref1 = "Y"
    endif

    mCoynum =  Coynum //", "C", 15, 0})  // Company No.
    mName1 = Name1 //", "C", 50, 0})  // Name Of Company
    mAutCap = AutCap // ", "n", 15, 2})  // Authorised Capital
    mNumShare = NumShare // ", "n", 13, 0})  // Number Of Shares
    mCoySec2 = CoySec2 // ", "C", 50, 0})  // Name Of Company Secretary

    cc1desp = mCoynum



    if (Select("tax3") == 0)
       use tax3 exclusive
    else
       select Select("tax3")
    endif 
    goto top
    zap


        Append Blank
        onerror("APPEND")
        replace recnum1 with 10001
        replace recnum with "Coynum"
        replace desp with "Company No."
        Append Blank
        onerror("APPEND")
        replace recnum1 with 10002
        replace recnum with "Name1"
        replace desp with "Name Of Company"
        Append Blank
        onerror("APPEND")
        replace recnum1 with 10012
        replace recnum with "AutCap"
        replace desp with "Authorised Capital"
        Append Blank
        onerror("APPEND")
        replace recnum1 with 10013
        replace recnum with "NumShare"
        replace desp with "Number Of Shares"
        Append Blank
        onerror("APPEND")
        replace recnum1 with 10018
        replace recnum with "CoySec2"
        replace desp with "Name Of Company Secretary"

        if (Select("tax3") == 0)
           use tax3 exclusive
        else
           select Select("tax3")
        endif 
        goto top

DEFINE DIALOG oDlg FROM 0, 0 TO 26, 79 ;
TITLE "Form 6 "

     @ -0.361, -0.1 to 13.945, 44.714
     @ -0.361, -0.1 to 12.545, 44.714

     select tax3

     index on recnum1 to TEMP99
     goto top


     crecnum1 = tax3->recnum1
     crecnum = tax3->recnum
     cdesp = tax3->desp

     @ 0.2, 0.4 LISTBOX oLbx FIELDS ;
        tax3->desp;
        HEADERS     "Description";
        FIELDSIZES  400 ;
        SIZE 307, 160 OF oDlg;
        FONT oFont

     oLbx:cToolTip = "Press `Enter' To Select Item."
          oLbx:bKeyDown := { | nKey, nFlags | If( nKey == VK_RETURN,;
          saycusta(,lreturn := .f., oc1desp:SetFocus() ),) }
     oLbx:bchange:={ || getform6c1desp(oc1desp), oc1desp:Refresh() }

     @ 12.5, 0.4 Get oc1desp VAR cc1desp size 307, 11 OF oDlG COLOR CLR_GREEN

@ 9.95, 18.7 BUTTON "&Accept" OF oDlg SIZE 40, 12 ;
ACTION (getform6cxdesp(oLbx), ;
oDlg:SetFocus() ,SysREfresh(), oLbx:SetFocus())
@ 9.95, 25.7 BUTTON "&Exit" OF oDlg SIZE 40, 12 ;
ACTION ( lreturn := .t., oDlg:End())
ACTIVATE DIALOG oDlg CENTERED

crecnum = tax3->recnum
select tax3
use
use tax3 exclusive
zap
use
select form6

return nil


function getform6c1desp(oc1desp)

    if (Select("form6") == 0)
       use form6 new
       set index to form6i
    else
       select Select("form6")
    endif

    select form6
    notfound = 1

    select form6
         goto top
         do while !eof()
             xSecondRef = trim(SecondRef)
             if trim(mSecondRef) = xSecondRef
                notfound = 2
                exit
             endif
             select form6
             skip 1
         enddo
        select form6


      mCoynum =  Coynum //", "C", 15, 0})  // Company No.
      mName1 = Name1 //", "C", 50, 0})  // Name Of Company
      mAutCap = AutCap // ", "n", 15, 2})  // Authorised Capital
      mNumShare = NumShare // ", "n", 13, 0})  // Number Of Shares
      mCoySec2 = CoySec2 // ", "C", 50, 0})  // Name Of Company Secretary

crecnum = tax3->recnum

if crecnum = "Coynum"
c1desp = mCoynum
elseif crecnum = "Name1"
c1desp = mName1
elseif crecnum = "AutCap"
c1desp = mAutCap
elseif crecnum = "NumShare"
c1desp = mNumShare
elseif crecnum = "CoySec2"
c1desp = mCoySec2
endif

cc1desp = c1desp
return oc1desp


function getform6cxdesp(oLbx)

local nOldRec := RecNo()

    c1desp = cc1desp
    if (Select("form6") == 0)
       use form6 new
       set index to form6i
    else
       select Select("form6")
    endif 
    select form6
   if Newedit = "1"
      if time1 = 1
         Append Blank
         onerror("APPEND")
         replace SecondRef with mSecondRef //", "c", 12, 0}) //Second Reference
         replace empno with mempnox  
         time1 = 2
      endif
  endif
  if Newedit = "1" .and. time1 = 1
  else
        notfound = 1
        select form6
        goto top
        do while !eof()
             xSecondRef = trim(SecondRef)
             if trim(mSecondRef) = xSecondRef
                notfound = 2
                exit
             endif
             select form6
             skip 1
         enddo
  endif

select form6
onerror("RLOCK")
if crecnum = "Coynum"
replace Coynum with c1desp
elseif crecnum = "Name1"
replace Name1 with c1desp
elseif crecnum = "AutCap"
replace AutCap with c1desp
elseif crecnum = "NumShare"
replace NumShare with c1desp
elseif crecnum = "CoySec2"
replace CoySec2 with c1desp
endif

cc1desp = c1desp
oLbx:SetFocus()
oLbx:Refresh()

return nil


function indexfile()

use form6 exclusive
pack
index on empno to form6i
use
return nil


function ONERROR

parameters errortype
errortype:= Upper(errortype)
do case
case errortype == "RLOCK"
if (RLock())
return .T.
endif
do while (!RLock())
InKey(3)
enddo
case errortype == "APPEND"
if (!neterr())
onerror("RLOCK")
return .T.
endif
do while (neterr())
InKey(3)
append blank
enddo
onerror("RLOCK")
endcase
return .T.


function saycusta()

return nil


The problem only occur immediately after the numeric fields.
Thanks

acwoo
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Problem Upgrading To FWH7.11
Posted: Fri Dec 14, 2007 03:58 PM
Acwoo,

In function getform6c1desp(oc1desp) add this code at the end:

if ValType( c1desp ) != ValType( cc1desp )  // new!
   oc1desp:oGet:VarPut( c1desp )  // new!
endif                                            // new!
cc1desp = c1desp 
return oc1desp
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 45
Joined: Fri Sep 28, 2007 08:53 AM
Problem Upgrade To FWH7.11
Posted: Sat Dec 15, 2007 12:59 AM

Thanks for your help

>In function getform6c1desp(oc1desp) add this code at the end:

>if ValType( c1desp ) != ValType( cc1desp ) // new!
> oc1desp:oGet:VarPut( c1desp ) // new!
>endif // new!
>cc1desp = c1desp
>return oc1desp

Now, after entering a numeric field, a text field can only accept numbers.
(The last row in the listbox, (mCoySec2 = CoySec2 // ", "C", 50, 0}) // Name Of Company Secretary), I cannot enter text after entering a numeric field earlier )

Please help

Thanks

acwoo
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Problem Upgrading To FWH7.11
Posted: Sat Dec 15, 2007 10:16 AM
Acwoo

This seems to work fine:
function getform6c1desp(oc1desp)
...
cc1desp = c1desp 

oc1desp:VarPut( cc1desp )
oc1desp:oGet = GetNew( 20, 20, oc1desp:bSetGet )
oc1desp:Refresh()

return oc1desp
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 45
Joined: Fri Sep 28, 2007 08:53 AM
Problem Upgrade To FWH7.11
Posted: Sat Dec 15, 2007 03:24 PM

Thanks a lot. Now it works.

Thanks again

acwoo

Continue the discussion