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 

Is here something wrong

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



Joined: 10 Mar 2008
Posts: 2814
Location: South Pole, Antarctica

PostPosted: Thu May 20, 2010 12:14 am    Post subject: Is here something wrong Reply with quote

or what i am trying to do (dynamically coloring output text in %cw) is just impossible?
Code:
   include <windows.ins>
   iun = 33
   kolRed=rgb@(255,0,0)
   kolGrn=rgb@(0,255,0)
   kol   =rgb@(0,0,255)

   i=winio@('%ac[esc]&','exit')
   i=winio@('%tc%55.15cw[vscroll,local_font]&',kol,iun)
   i=winio@('%lc&',ihw)
   i=winio@('%lw',ilw)   
   do i=1,15
     kol=kolGrn
     call SET_CONTROL_TEXT_COLOUR@(ihw,kol)
     write(iun,*) 'Green'
           call temporary_yield@
           call sleep1@(0.5)
     kol=kolRed
     call SET_CONTROL_TEXT_COLOUR@(ihw,kol)
     write(iun,*) 'Red'
   enddo

   end
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Mon May 24, 2010 8:29 am    Post subject: Reply with quote

You cannot change the colour in a %cw control on a line by line basis.
It can be done with a %eb control but not in the direct way implied by your code. The next release of the library makes it easier for the programmer when using %eb but it is still tricky. If you are really keen I could try to explain how it works.
Back to top
View user's profile Send private message AIM Address
DanRRight



Joined: 10 Mar 2008
Posts: 2814
Location: South Pole, Antarctica

PostPosted: Mon May 24, 2010 10:03 pm    Post subject: Reply with quote

Sure. I love your enhancements.
cwplus.enh file is the place i look first Smile
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Tue May 25, 2010 7:50 am    Post subject: Reply with quote

You will find some information in ftn95.chm under Win32 Platform->ClearWin+->Edit box (%eb)->%N.Meb[options].

You use the option [user_colours] together with the Edit info values 15 and 16 in the %eb callback function. The "callback reason" is "COLOURING".

When your text display needs to be refreshed (e.g. because something that covered it has been moved) then ClearWin+ sends information to your callback function about the text and the number of characters that are about to be redisplayed. Your callback function then uses other edit info values to specify the text and background colouring that you want for this text.

This is the kind of approach that you would take if you wanted to apply syntax colouring to (say) the display of a Fortran program. i.e. your callback would provide an algorithm to detect and colour the keywords etc.

I have added some new functions for the next release of the library and these can be used in the calback function in order to set the colours in a relatively simple way. You can do it at the moment but only by using addresses provided in the edit info structure (i.e. you have to do some tricky programming with CCORE1 etc).
Back to top
View user's profile Send private message AIM Address
DanRRight



Joined: 10 Mar 2008
Posts: 2814
Location: South Pole, Antarctica

PostPosted: Wed May 26, 2010 10:05 pm    Post subject: Reply with quote

I've just remembered another trick of coloring text with %eb i've used years ago but completely forgot it. To color the entire line with needed color the %st can be used. The output looks like this



This is used to color the line in the initial data file where error occured

If you have no plans to add coloring to %cw then i might change to %eb...
Was %eb implemented similarly to %cw in terms of internal buffer sizes restrictions? My code prints into %cw windows whole day probably many megabytes of text and i do not worry because nothing ever happened, no crashes or weird behavior. It is probably more reliable then usual DOS window. But with %eb 10 or more years ago as i remember there were some issues with text size. May be not anymore
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Thu May 27, 2010 12:28 pm    Post subject: Reply with quote

As I recall %eb and %st are independent controls.

%cw has a maximum buffer size that you can set using set_max_lines@ or set_all_max_lines@.

With %eb you can provide your own text buffer which you can make as large as you like. Otherwise the buffer size will grow on demand.

I have no plans to extend %cw so that it can be used with multiple colours.
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