View previous topic :: View next topic |
Author |
Message |
Martin_K
Joined: 09 Apr 2020 Posts: 227
|
Posted: Wed May 06, 2020 6:26 pm Post subject: Some spacing problems with %bf and %ul |
|
|
Hi to anybody!
I would like to share (and also ask) the following problems when using %bf and/or %ul format codes.
In some dialogs I created I would like to stress some information using either %bf and/or %ul for some important words. I used them, but both cause an inappropriate distance spacing between last word (written with %sf) and subsequent one (which is already written either with %bf and/or %ul).
Part of my code is here (text to be appeared in the dialog is in SK language):
The correct spacing using %sf can be seen here:
The abnormal (unwanted) spacing after using %bf and/or %ul can be seen here:
Has anybody an idea what is wrong?
Martin |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Wed May 06, 2020 6:59 pm Post subject: |
|
|
Hi Martin,
It's how Clearwin+ decides the spacing, which is based on the average character cell width, During development, you can draw the grid in your dialog box with the %gd format code. What is probably happening is that one or more of your characters is wider when made bold or underlined by a pixel, and that throws you to the next cell.
There are several work-arounds. One is to re-arrange your message so that it doesn't matter, for example, by giving "*.csv" a line all of its own, something like "*.csv Warning!"
Or, you can create an image and position it using the positioning format codes.
Or, you can make your emphasis using colour.
Eddie |
|
Back to top |
|
|
Martin_K
Joined: 09 Apr 2020 Posts: 227
|
Posted: Wed May 06, 2020 7:16 pm Post subject: |
|
|
Thanks Eddie! I will immediately use a colour distinction which takes
several seconds and later I´ll try to use the others to learn it. |
|
Back to top |
|
|
Martin_K
Joined: 09 Apr 2020 Posts: 227
|
Posted: Wed May 06, 2020 7:29 pm Post subject: |
|
|
Eddie,
I am afraid the coloring does not work (there are still unwanted spaces)
as can be seen here:
I added to my code just %tc[red] and %bf is removed. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7924 Location: Salford, UK
|
Posted: Wed May 06, 2020 7:44 pm Post subject: |
|
|
Martin
Please post the code for this display so that I can look at how it is formed. |
|
Back to top |
|
|
Martin_K
Joined: 09 Apr 2020 Posts: 227
|
Posted: Wed May 06, 2020 7:57 pm Post subject: |
|
|
Paul,
the code is here:
|
|
Back to top |
|
|
Kenneth_Smith
Joined: 18 May 2012 Posts: 697 Location: Hamilton, Lanarkshire, Scotland.
|
Posted: Wed May 06, 2020 9:04 pm Post subject: |
|
|
Something like this perhaps?
Code: | implicit none
include<windows.ins>
integer iw
iw = winio@('%bg[white]&')
iw = winio@('%nl%tc[black]%ws%tc[white]%ws%tc[red]%ws&','Message','S','*.csv')
iw = winio@(' ')
end |
Ken |
|
Back to top |
|
|
Martin_K
Joined: 09 Apr 2020 Posts: 227
|
Posted: Wed May 06, 2020 9:53 pm Post subject: |
|
|
Thanks Ken!
I re-coded as you outlined, but nothing changed. Even, when I used the %sf
for all text put in your style, the unwanted spacing between last word and *.csv remained.
A question: because of special letters in slovak alphabet (the letters with accent and wedge) I use CALL ENABLE_UTF8@(1). Could have this something to do with the issue? |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Wed May 06, 2020 10:14 pm Post subject: |
|
|
Martin,
Instead of making your code an image, perhaps you can put the code in between the two tags like this:
(If you highlight the fortran statements and click the Code button, the tags are put in for you).
This enables us to copy and paste the code to try it out without retyping it.
Eddie |
|
Back to top |
|
|
Martin_K
Joined: 09 Apr 2020 Posts: 227
|
Posted: Wed May 06, 2020 10:28 pm Post subject: |
|
|
Sorry Eddie, I didn´t know it! Here is as you wanted:
Code: |
INTEGER FUNCTION sb_vstup4() ! Call-back funkcia pre button VYBRAŤ VÝSTUPNÝ SÚBOR na zvolenie a zapísanie mena (aj s cestou) výstupného súboru do boxu v hlavnom okne
IMPLICIT NONE
LOGICAL, EXTERNAL :: FEXISTS@
LOGICAL L
CHARACTER*129 subor3, subor4
INTEGER*4 sb_vstup4, button_grey_control, err_code, w, h, ans
COMMON/cel_cisla1/button_grey_control
COMMON/retazec1/subor3
COMMON/retazec2/subor4
IF(FEXISTS@(subor4,err_code)) then
IF(subor4.eq.subor3) THEN
w=0
h=0
ans=winio@('%sz&',w,h)
ans=winio@('%ca[Info o zvolenom výstupnom súbore]&')
ans=winio@('%si#%ta%sf%cnNie je možné vybrať rovnaký názov výstupného súboru,&')
ans=winio@('%nl%taaký má aj vstupný súbor! Mením koncovku súboru na *.CSV!&')
ans=winio@('%2nl%cn%9`bt[OK]')
!!! ans=winio@('%si#%ta%cn%ws&','Nie je možné vybrať rovnaký názov výstupného súboru,')
!!! ans=winio@('%nl%ta%cn%ws&','aký má aj vstupný súbor! Koncovka bude automaticky zmenená na ')
!!! ans=winio@('%ws&','.csv')
!!! ans=winio@(' &')
!!! ans=winio@('%2nl%cn%9`bt[OK]')
CALL SET_SUFFIX@(subor4,'CSV',L) ! Volanie internej funckie FTN95 SETSUFFIX@ na zmenu koncovky mena vystupneho suboru
ELSE
w=0
h=0
ans=winio@('%sz&',w,h)
ans=winio@('%ca[Info o zvolenom výstupnom súbore]&')
ans=winio@('%si!%ta%sf%cnSúbor už existuje! Ak nezmeníte názov súboru, bude prepísaný!&')
ans=winio@('%2nl%cn%9`bt[OK]')
END IF
END IF
sb_vstup4=2
CALL window_update@(subor4)
END Function sb_vstup4
|
|
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7924 Location: Salford, UK
|
Posted: Thu May 07, 2020 8:22 am Post subject: |
|
|
This appears to be a problem when using UTF8 encoding. I will make a note that it needs investigating. At the moment I don't have a work-around. |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Thu May 07, 2020 12:05 pm Post subject: |
|
|
Hi Martin,
Not a problem, trust me! Paul always likes small demonstrator programs, and he doesn't have time to retype things - and most of us don't have other language keyboards!
The standard icon you have chosen is the one for what is probably an irrecoverable error so the information (i) or warning (!) icons are more relevant.
Since you are changing the file extension, you could always put the completed name on a third line, which will resolve your problem temporarily.
The Windows UI guide says to always use an action word on buttons, so it is probably 'Accept' (in Slovak) rather than 'OK' although OK is simple and short and international. What happens if the user isn't happy with that? There is currently no way out except to accept the change. If the user is not content to accept the change, the dialog needs a 'Reject' button, which should take him back to the dialog where he can choose a different file name. It is also a good idea to have an audible warning 'beep' for such dialogs, but make it so that the user can switch off audible warnings in the Options or Settings window.
It is details like this that make the application much more usable and professional looking.
In Windows 10 the current advice is to make the buttons right justified, not centred. The buttons are typically less tall, which you can get with a different button format code (i.e. not %bt). I think that the dialogs look good if you put a line under the information and above the buttons with %bx, but that is what I like. I also put my standard icon in its own %ob - %cb and the text in another, then it is easier to make the standard icon lower.
I hope some of this is useful.
Best regards
Eddie |
|
Back to top |
|
|
Martin_K
Joined: 09 Apr 2020 Posts: 227
|
Posted: Thu May 07, 2020 1:49 pm Post subject: |
|
|
Thanks Paul and Eddie,
Paul,
I also have some other small issues with Plato, when I switching between ASCII and Unicode UTF-8 during creation of a program.
I mean, when I originally start to write the f95 file as ASCII and later I find that I have to use some letters of slovak alphabet, which are not part of ASCII standard. I also could post it (but they are not critical). All this relates to v8.61 and Plato v5.2.0.
Eddie,
I will try your suggestions.
Best wishes!
Martin
Martin |
|
Back to top |
|
|
Kenneth_Smith
Joined: 18 May 2012 Posts: 697 Location: Hamilton, Lanarkshire, Scotland.
|
Posted: Thu May 07, 2020 3:01 pm Post subject: |
|
|
You could create a small graphics image with the desired lines of text, then create a %gr region the same size as the graphics file (i.e. same x/y pixel size), and after the %gr region is created, copy the graphics file to that region using IMPORT_IMAGE@.
The trick here is to make sure the background colour of the window you are creating is the same as the background colour of the image you are importing. I use this often, for example when I want to include mathematical equations, and these already exist in a word document so it is straightforward to get a graphics image.
The downside is you then have image resources to manage in your code.
Ken |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7924 Location: Salford, UK
|
Posted: Thu May 07, 2020 3:06 pm Post subject: |
|
|
This fault has now been fixed for the next release of the Silverfrost DLLs.
Plato has an item in the File menu called "Advanced Save Options...". When adding UTF-8 characters to your code you should select "Unicode UTF-8 without signature" before saving. (I can see a couple of spelling mistakes in that Plato dialog which I will fix). |
|
Back to top |
|
|
|