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 

Clearwin text boxes

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General
View previous topic :: View next topic  
Author Message
acp693



Joined: 04 Sep 2006
Posts: 56

PostPosted: Mon Sep 04, 2006 2:12 pm    Post subject: Clearwin text boxes Reply with quote

Hi,

I would like to be able to use more than one text box or label(I'm not sure what they are called), on a clearwin gui, and be able to update them independantly.
However when I update the boxes, all updates are directed at only one box. The following code shows the problem. the second textbox doesn't get updated.

Many thanks

Albert


WINAPP
PROGRAM testTextBoxes
IMPLICIT NONE
INCLUDE <windows.ins>
EXTERNAL updatetext1
EXTERNAL updatetext2
INTEGER ans
CHARACTER*50 str1,str2
COMMON str1, str2
str1=' '
str2=' '
ans=winio@('%ca[Number Factoriser]&')
ans=winio@('%ta%`^bt[Updatetext1]&',updatetext1)
ans=winio@('%ta%^bt[Updatetext2]&',updatetext2)
ans=winio@('%2nl%ob%42st%cb&',str1)
ans=winio@('%2nl%ob%42st%cb',str2)
END

INTEGER FUNCTION updatetext1()
CHARACTER*50 str1
COMMON str1
str1="hello"
CALL window_update@(str1)
updatetext1=1
END

INTEGER FUNCTION updatetext2()
CHARACTER*50 str2
COMMON str2
str2="goodbye"
CALL window_update@(str2)
updatetext2=1
END
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Mon Sep 04, 2006 5:44 pm    Post subject: Clearwin text boxes Reply with quote

Use the same common declaration in all routines.

CHARACTER*50 str1,str2
COMMON str1, str2

Better still, define str1 and str2 in a module and use the module in all routines. One of the benefits of modules is it takes away the problems with common declaration compatibility. There are lots of others, but the ability to define (once) and use variables globally, wherever they are USEd removes a lot of simple coding errors.

WINAPP
module string_definition
CHARACTER*50 str1,str2
end module string_definition

PROGRAM testTextBoxes
use string_definition
IMPLICIT NONE
INCLUDE <windows.ins>
EXTERNAL updatetext1
EXTERNAL updatetext2
INTEGER ans

str1=' '
str2=' '
ans=winio@('%ca[Number Factoriser]&')
ans=winio@('%ta%`^bt[Updatetext1]&',updatetext1)
ans=winio@('%ta%^bt[Updatetext2]&',updatetext2)
ans=winio@('%2nl%ob%42st%cb&',str1)
ans=winio@('%2nl%ob%42st%cb',str2)
END

INTEGER FUNCTION updatetext1()
use string_definition

str1="hello"
CALL window_update@(str1)
updatetext1=1
END

INTEGER FUNCTION updatetext2()
use string_definition

str2="goodbye"
CALL window_update@(str2)
updatetext2=1
END
Back to top
View user's profile Send private message
acp693



Joined: 04 Sep 2006
Posts: 56

PostPosted: Tue Sep 05, 2006 1:18 am    Post subject: Clearwin text boxes Reply with quote

Thankyou very much! thats just what I wanted. I was using the 'common' statement as it's used in the clearwin+ examples a lot.
Back to top
View user's profile Send private message
JohnHorspool



Joined: 26 Sep 2005
Posts: 270
Location: Gloucestershire UK

PostPosted: Wed Sep 06, 2006 12:59 am    Post subject: Clearwin text boxes Reply with quote

Albert,

Sorry to have to disagree with you, but your problem stemmed from your incorrect usage of the common statement, as John Campbell pointed out. The examples that I've seen have always used the common statement correctly. I only use common statements in my Clearwin+ code to pass data.

regards
John
_________________
John Horspool
Roshaz Software Ltd.
Gloucestershire
Back to top
View user's profile Send private message Visit poster's website
acp693



Joined: 04 Sep 2006
Posts: 56

PostPosted: Thu Sep 07, 2006 7:56 am    Post subject: Clearwin text boxes Reply with quote

quote: acp693
Thankyou very much! thats just what I wanted. I was using the 'common' statement as it's used in the clearwin+ examples a lot.
end quote


John Horspool, yes I realize I was doing something wrong. I'm puzzled as to what you disagree with, as I simply stated that I was using the common statement(instead of the module/use approach as suggested by John Cambell) as it's used in the examples a lot. I wasn't aware that one could declare the variables in a module and then make them available with the use statement.

Thanks

Albert
Back to top
View user's profile Send private message
brucebowler
Guest





PostPosted: Thu Sep 07, 2006 1:27 pm    Post subject: Clearwin text boxes Reply with quote

It may be a "language" (as in native tongue, not FORTRAN) issue.

One interpretation of "as it's used in the clearwin+ examples" is "in the same way it is used in the clearwin+ examples",
another is "since it's used in the clearwin+ examples".

My guess is John interpreted it as the first way, while you meant it as the second way.
Back to top
acp693



Joined: 04 Sep 2006
Posts: 56

PostPosted: Sat Sep 09, 2006 4:32 am    Post subject: Clearwin text boxes Reply with quote

Yes Bruce, I think you are right. Anyway, I'm happy that my problem is solved. Thanks to all that helped.

Regards

Albert
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General 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