forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Problem with ADD_MENU_ITEM@

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
EKruck



Joined: 09 Jan 2010
Posts: 224
Location: Aalen, Germany

PostPosted: Tue Apr 21, 2020 9:35 am    Post subject: Problem with ADD_MENU_ITEM@ Reply with quote

Using FTN95 8.62.1 I received the following error message:
Code:
           CALL ADD_MENU_ITEM@ (iDynMenuHandle, cLastProjects(I), 1, 0, CB_OldProject)
*** Error 1244: The third argument of ADD_MENU_ITEM@ is passed as a reference that should not be a constant nor an expression
*** Error 1244: The fourth argument of ADD_MENU_ITEM@ is passed as a reference that should not be a constant nor an expression

after changing the constants 0 and 1 to iZero and iOne, the software is not working anymore correct.
First setting of the older projects into menu works fine. I can select a project. After selection I remove and then update the list of projects. But then it gets funny: sometimes the projects have a checkbox in front; sometimes they are greyed; and sometimes both. This did never happen before.
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Tue Apr 21, 2020 10:04 am    Post subject: Reply with quote

I suspect that there is something else causing this failure.

These error reports can be fixed by:

1) replacing 0 by iZero which has been given the value 0 etc. or
2) suppressing error 1244.

If you use method (2) then it may reveal that something else is causing the failure. If not then I think that I would need a demo program to look at.
Back to top
View user's profile Send private message AIM Address
EKruck



Joined: 09 Jan 2010
Posts: 224
Location: Aalen, Germany

PostPosted: Tue Apr 21, 2020 1:50 pm    Post subject: Reply with quote

It's definitely a bug in ADD_MENU_ITEM@.
Changing back to calls with constants and using OPTIONS (ignore 1244), the program is running again perfectly.
Code:

OPTIONS (ignore 1244)

    SUBROUTINE UpdateProjectList (cDir, iAction)
    USE      bbmanData
    IMPLICIT NONE
    INCLUDE  <clearwin.ins>
    CHARACTER    cDir*(*)         ! Directory name
    INTEGER      iAction          ! Action key:   -1=remove;   +1=add
    INTEGER      I, J  !--- , iZero, iOne
    INTEGER, EXTERNAL :: CB_OldProject, CB_EXIT

    DO I= 1, iNrOfLastProj+2
       CALL REMOVE_MENU_ITEM@ (iDynMenuHandle)
    ENDDO

    SELECT CASE (iAction)
       CASE (-1)                  ! Eliminate cDir from list
       
          DO I= 1, iNrOfLastProj
             IF (cDir .EQ. cLastProjects(I)) cLastProjects(I) = ' '
          ENDDO
          J = 1
          DO I= 1, iNrOfLastProj
             cLastProjects(J) = cLastProjects(I)
             IF (cLastProjects(I) .NE. ' ') J = J + 1
          ENDDO
          iNrOfLastProj = J - 1

       CASE (+1)                  ! Shift project names down and add new project on top

          DO I= 9, 2, -1
             cLastProjects(I) = cLastProjects(I-1)
          ENDDO
          J = INDEX (cDir, char(0))
          IF (J .GT. 0 ) cDir(J:) = ' '
          cLastProjects(1) = cDir
          IF (iNrOfLastProj .LT. 9)  iNrOfLastProj = iNrOfLastProj +1

    END SELECT

!-- iZero = 0
!-- iOne  = 1
    DO I= 1, iNrOfLastProj
       IF (cLastProjects(I) .NE. ' ') THEN
!--       CALL ADD_MENU_ITEM@ (iDynMenuHandle, cLastProjects(I), iOne, iZero, CB_OldProject)
          CALL ADD_MENU_ITEM@ (iDynMenuHandle, cLastProjects(I), 1, 0, CB_OldProject)
       ENDIF
    ENDDO
    IF (iNrOfLastProj .GT. 0)  CALL ADD_MENU_ITEM@ (iDynMenuHandle, CHAR(0), 0, 0, CB_EXIT)
                               CALL ADD_MENU_ITEM@ (iDynMenuHandle, 'Save and E&xit', 1, 0, CB_EXIT)
!-- IF (iNrOfLastProj .GT. 0)  CALL ADD_MENU_ITEM@ (iDynMenuHandle, CHAR(0), iZero, iZero, CB_EXIT)
!--                            CALL ADD_MENU_ITEM@ (iDynMenuHandle, 'Save and E&xit', iOne, iZero, CB_EXIT)
    RETURN
    END SUBROUTINE UpdateProjectList

The Program is very large and complex. I don't think that I can make a small example to demonstrate the problem.
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Tue Apr 21, 2020 3:57 pm    Post subject: Reply with quote

I have found another way to get around this problem.

There is an old alternative to ADD_MENU_ITEM@ which has the same name but without the @. The alternative allows literal 0 and 1 for these arguments.

Like ADD_MENU_ITEM@ it is declared in clearwin.ins.

p.s. Another thought: iZero and iOne probably need to be global (e.g. SAVEd) and not local.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group