SAY / GET behaviour

Post Reply
Carlo Stonebanks
Posts: 17
Joined: Tue Apr 10, 2007 11:10 pm

SAY / GET behaviour

Post by Carlo Stonebanks »

Hi Antonio,

I'm finally starting to post questions regarding the legacy code port that I have to do. I am starting by converting my low-level video functions, so things are starting off with very basic display issues:

The following code produces strange results for me:

Code: Select all | Expand

#include "fivewin.ch"

FUNCTION Main()
   local oWnd, cText := "GET_TEXT"
   DEFINE WINDOW oWnd TITLE "TEST WINDOW"
   @ 2, 2 SAY "SAY_TEXT" COLOR 1
   @ 2, 30 GET cText
   @ 3, 10 BUTTON "&Button" SIZE 80, 20
   ACTIVATE WINDOW oWnd
RETURN NIL


First, I have to specify COLOR in the SAY statement, or the text does not appear (perhaps it is being rendered in the Windows background colour?)

Second, the text being rendered by the SAY statements is truncated, it appears that the label is not correctly calculating the length required for the ALL CAPS text. If so, how can I help @ .. SAY .. better calculate this?

Third, SAY and GET are both defined on row 2, but they do not actually display in line wth each other.

Thanks,

Carlo[/img]
User avatar
Richard Chidiak
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France
Contact:

Re: SAY / GET behaviour

Post by Richard Chidiak »

Carlo

If you want to use windowsd and dialogs from source code (you can do it from resources rc files also), it is much easier to use the "pixel" clause

This is a sample

@ 5,140 SAY "N°" OF odlg SIZE 20,15 COLOR CLR_HBLUE,CLR_WHITE FONT AFONT BORDER CENTER PIXEL

As per the get issue a picture clause and define it in pixels

Hth

Richard
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
Carlo Stonebanks
Posts: 17
Joined: Tue Apr 10, 2007 11:10 pm

Re: SAY / GET behaviour

Post by Carlo Stonebanks »

Richard Chidiak wrote:Carlo
If you want to use windowsd and dialogs from source code (you can do it from resources rc files also), it is much easier to use the "pixel" clause


Thanks for the suggestion Richard. Unfortunately, this project involves around 900 PRG files containing thousands of screen definitions. I need to use the existing coordinate system and get that to work. (Of course, using a monospaced font will help).

The good news is 99% of these screens were created with a screen painter/code generator - so the coding practices are predictable and uniform. I just need to get my UI support libraries recoded to be able to produce both DOS and Windows controls and graphics.

Carlo
User avatar
Antonio Linares
Site Admin
Posts: 42556
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 80 times
Contact:

Post by Antonio Linares »

Carlo,

You may review fwh\include\constant.ch

If you modify those values and recompile the FWH Classes (PRG) then you may fine tune the screen position and sizes of the controls to mimic your MsDos screens

i.e.: in Class TSay there is a:

DEFAULT nWidth := SAY_CHARPIX_W * Len( ::cCaption ) - 4

Depending of the font that you finally decide to use, and modifying SAY_CHARPIX_W, you may get the automatic Say size that you need.

The same applies for the Gets and other controls (like Buttons) that you may need to create
regards, saludos

Antonio Linares
www.fivetechsoft.com
Carlo Stonebanks
Posts: 17
Joined: Tue Apr 10, 2007 11:10 pm

Post by Carlo Stonebanks »

Antonio Linares wrote:Carlo,

You may review fwh\include\constant.ch


Thanks Antonio.

1) How do I fix the prolem of the default colour settings of SAY statements?

2) Where do I find instructions on how to rebuild the libraries, especially since I use the XCC compler?

Carlo
User avatar
Richard Chidiak
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France
Contact:

Post by Richard Chidiak »

Carlo

\fwh\source\classes\say.prg

You can change the default colour as you wish

You do not have to rebuild the libraries for xcc (not recommended), if you change a fwh program like say.prg just add it to your programs and they will get compiled before fwh. I also use xcc, if you need any further explanation, do not hesitate

regards

Richard
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
Carlo Stonebanks
Posts: 17
Joined: Tue Apr 10, 2007 11:10 pm

Post by Carlo Stonebanks »

Thanks Richard,

Richard Chidiak wrote:Carlo

\fwh\source\classes\say.prg

You can change the default colour as you wish


How? SET COLOR doesn't seem to do this.

Richard Chidiak wrote:You do not have to rebuild the libraries for xcc (not recommended), if you change a fwh program like say.prg just add it to your programs and they will get compiled before fwh.


I don't like recompiling the libraries either, but I am not developing for myself. I am developing for a very large legacy application port project with 900 modules and for a programmer who is not used to very technical issues. I want to simplify things as much as possible. This is a complication, and I'm paid to make things simple.

For this reason I won't just change the numeric literals in the constants.ch file, I will replace the literals with "get" function calls that return default values. This way the default values can be set by the calling program at run time, not compile time.
User avatar
Antonio Linares
Site Admin
Posts: 42556
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 80 times
Contact:

Post by Antonio Linares »

Carlo,

> This way the default values can be set by the calling program at run time, not compile time.

Very good idea :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Carlo Stonebanks
Posts: 17
Joined: Tue Apr 10, 2007 11:10 pm

Post by Carlo Stonebanks »

Hi,

I have come back to this issue, and I have modified CONSTANT.CH

How do I safely recompile the FWH libs for xHarbour (my install uses the xcc compiler)? I couldn't find anything obvious in the documentation.

Carlo
User avatar
Antonio Linares
Site Admin
Posts: 42556
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 80 times
Contact:

Post by Antonio Linares »

Carlo,

We don't recommend our users to rebuild the library from PRGs to avoid possible errors, anyhow here you have a xHarbour builder project to rebuild it:

http://rapidshare.com/files/32956835/Fi ... b.zip.html
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply