Not all characters of a get field are visible

Not all characters of a get field are visible

Postby gkuhnert » Tue Nov 25, 2008 3:14 pm

Hi,

sometimes it happens, that not all characters in a get-field are visible and reachable. It happens, when the content of a get field is exactly one character longer than the display length.

Here a self-containing example:

Code: Select all  Expand view
#include "FiveWin.ch"

function Main()

   local oTest, oDlg
   local cTest := "22MM23456789012"

   SET _3DLOOK ON

   DEFINE DIALOG oDlg TITLE "A simple GET" FROM 2, 2 TO 13, 40

   @ 30, 10 GET oTEST VAR cTest SIZE 49, 12 pixel OF oDlg PICTURE "XXXXXXXXXXXXXXX"

   ACTIVATE DIALOG oDlg CENTERED

return nil


if the cursor is in this get field and you walk with the arrow to the right, the last character in it "2" isn't visible in any way. But if you mark the characters, for example if you hold shift and then use the right-arrow, the last character suddenly appears. Has someone experienced something similar and/or has someone a solution for this problem?
Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
User avatar
gkuhnert
 
Posts: 274
Joined: Fri Apr 04, 2008 1:25 pm
Location: Aachen - Germany // Kerkrade - Netherlands

Postby James Bott » Tue Nov 25, 2008 8:09 pm

Add the HSCROLL clause to your GET definition.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby gkuhnert » Wed Nov 26, 2008 9:05 am

James,

how do I add the HSCROLL clause to my GET definition? I didn't find any example on this and in the manual I didn't find any clue either on this topic.
Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
User avatar
gkuhnert
 
Posts: 274
Joined: Fri Apr 04, 2008 1:25 pm
Location: Aachen - Germany // Kerkrade - Netherlands

Postby gkuhnert » Wed Nov 26, 2008 9:17 am

James,

OK, now I found out, but then I get a scroll-bar. That's not what I wanted. Normally you can use the arrow-keys to scroll through the get field. And if there are characters, that don't fit in the actual display of the get field, you can get there by pressing the right arrow key several times. But in some cases, like in the example I provided, the last character isn't reachable. However, if you, for example, delete the first character, you can see that there is a character hidden, which didn't show up before.
Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
User avatar
gkuhnert
 
Posts: 274
Joined: Fri Apr 04, 2008 1:25 pm
Location: Aachen - Germany // Kerkrade - Netherlands

Postby James Bott » Wed Nov 26, 2008 3:09 pm

Gilbert,

I notice in your example that the picture and the data are both exactly the same length (15) so it seems that your SIZE clause is defining the width as too small to hold the data. Try expanding the width.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Horizon » Wed Nov 26, 2008 3:51 pm

Hi,

I think this is related to Get Class.

Look at this thread:
http://forums.fivetechsoft.com/viewtopic.php?p=63949&highlight=#63949
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1288
Joined: Fri May 23, 2008 1:33 pm

Postby StefanHaupt » Thu Nov 27, 2008 8:46 am

Gilbert,

you can add the style ES_AUTOHSCROLL to your get or use the picture clause S<n> to move the get horizontally. But don´t know, if the picture clause is working in windows.
kind regards
Stefan
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Postby gkuhnert » Thu Nov 27, 2008 10:31 am

James,

generally the get field isn't filled by code, but by the user. And there are fields in our database, that are exactly 15 characters, so the get-field also should contain exactly 15 characters, otherwise the customer might be complaining about entered characters that are not saved properly. So changing the picture to 16 characters isn't an option.


Horizon,

yes, this topic might be related to your topic. Because the cursor doesn't go behind the last character, the last character doesn't show up, if all characters before the last exactly fit into the get field.


Stefan,

how does the picture clause S<n> work? In my own program, where the same error shows up, my get-field in the .rc file is declared like this:
Code: Select all  Expand view
EDITTEXT 1046, 236, 20, 63, 12, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP


So it seems, that ES_AUTOHSCROLL is already added properly.
Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
User avatar
gkuhnert
 
Posts: 274
Joined: Fri Apr 04, 2008 1:25 pm
Location: Aachen - Germany // Kerkrade - Netherlands

Postby Enrico Maria Giordano » Thu Nov 27, 2008 12:28 pm

gkuhnert wrote:James,

generally the get field isn't filled by code, but by the user. And there are fields in our database, that are exactly 15 characters, so the get-field also should contain exactly 15 characters, otherwise the customer might be complaining about entered characters that are not saved properly. So changing the picture to 16 characters isn't an option.


James is right. You have to increase GET's horizontal size, that has nothing to do with the number of characters that the user can type. The latter is set by the lenght of the string variable. And consider that the length of the typed string depends on the typed characters, at least using a proportional font, so you'll have to use a greater horizontal GET size anyway.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8315
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby James Bott » Thu Nov 27, 2008 1:50 pm

Gilbert,

As I said, use the SIZE clause to increase the width, NOT the PICTURE clause.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby StefanHaupt » Fri Nov 28, 2008 8:31 am

Gilbert,

your rc file seems to be ok, you should be able to move the cursor inside the get field to the invisible characters, the text scrolls horizontally.

The S<n> picture clause does the same in clipper and console programs, I never used it in windows, so I don´t know if this is really working.

If you want to see all characters without scrolling, you have to increase the size of the get field, as james already said.
kind regards
Stefan
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Postby gkuhnert » Fri Nov 28, 2008 11:45 am

James,

I'm sorry, I misinterpreteded your answer, but resizing is also not an option, because theoratically we'd have to make the get's so big, that even 15 "M" oder "W" Characters could fit in.

Stefan,

Scrolling would be ok, but the last character doesn't show up at all...
If I fill the Get with 22MM23456789WMW instead of 22MM23456789012, the problem doesn't show up, although there are more pixels needed to display the string. Then scrolling works fine.

We changed the tget-class like this:
from
Code: Select all  Expand view
               if nKey == VK_END
                  ::oGet:End()
                  ::SetPos( ::oGet:Pos )
               endif

to
Code: Select all  Expand view
               if nKey == VK_END
                  ::oGet:End()
                  ::SetPos( ::oGet:Pos ) + 1
               endif


And now the cursor stands behind (and not before) the last character if you press the "end"-key, so all characters are being displayed.
So the get-class seems to contain a bug at this place.
Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
User avatar
gkuhnert
 
Posts: 274
Joined: Fri Apr 04, 2008 1:25 pm
Location: Aachen - Germany // Kerkrade - Netherlands

Postby James Bott » Sat Nov 29, 2008 4:20 pm

Gilbert,

I'm sorry, I misinterpreteded your answer, but resizing is also not an option, because theoratically we'd have to make the get's so big, that even 15 "M" oder "W" Characters could fit in.


Well, possibility is not probability. There is a possibility that a user could enter a string of W's but it is very improbable. So, you can make it shorter than that. Further, I don't think that 15 characters even when using the width of 15 Ws, is a real problem.

And now the cursor stands behind (and not before) the last character if you press the "end"-key, so all characters are being displayed.
So the get-class seems to contain a bug at this place.


You may consider it a bug, but the GET was designed to emulate the Clipper GET and it does work the same as the Clipper GET. Changing it now may break existing code.

What might be nice is a CLASS DATA option to change the behavior to that of a standard Window's Edit control. For those that don't know, CLASS DATA is like a PUBLIC in that it only needs to be set once in an application and all GETs in that application will inherit that value.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 100 guests