NetTalk Central

Author Topic: Bypassing read-only fields  (Read 2940 times)

Keith

  • Sr. Member
  • ****
  • Posts: 306
    • View Profile
    • Email
Bypassing read-only fields
« on: April 15, 2014, 02:35:14 AM »
Hi

I recently asked on the Forum whether there was an easy way of 'bypassing' read only fields on a Form.  What I meant by this is to stop the cursor entering a read-only field box after a 'tab' or 'return' key.  Have a look at the attached Read-only png file.

There are two blocks of fields and it made no sense for the cursor to end up in the blue block of fields (the read-onlys).  One answer was to declare these fields to be 'display' but this caused all of the nice read-only styles to be lost.  the next suggestion was to stick with 'display but to add css to make it look like the original.

I quailed because I have only just learned how to spell 'cascading style sheet' and I thought that this would be a trick too far.  However, using Firefox and 'inspect element' I managed to deduce which commands gave the 'read-only' look and I duly added a 32 line css to CustomT.css  It looked awful but it did the job 99%.  the missing 1% was that the text sat in the box a smidgen higher than 'middle' and I couldn't get it to shift - no matter what.

So I sent it off to a friend who is a .Net programmer and a web developer and confessed ignorance and asked for help with the positioning problem.  This is what he returned to me:

.my-readonly{
background-color: #E2F9Fe;
color:#000;
width:39.6px;
min-height:19.8px;
font-size:13.2px;
font-family:Trebuchet MS,Tahoma,Veranda,Arial,sans-serif;
font-weight:400;
border-radius:4px;
border:1px solid #888;
border-collapse:collapse;
text-align:right;
vertical-align:text-middle;
margin:2px 0;
padding:2px 2px 0 2px;
}

This is less than half of my attempt so a great consolidation.  He also made the following comment about the vertical alignment of the text:

'I’m not 100% sure why vertical-align isn’t working, except that it might be because the div is a block element.  I think if you had a span element inside your div, then it would work, but you probably don’t have much control over how nettalk renders it.  I just worked around it by adding 2px of padding to the top of the element.'

So I'm sharing this because I think to have this css which turns a display into a read-only look provides a big benefit to your Form (it has for mine).  I provide this detail and comment because it may be useful and you may be able to improve on it.

Cheers

Keith

[attachment deleted by admin]
Clarion 10.0.0 build 12799
NetTalk 9.31
StringTheory 2.65
InsightGraphing 2.27

terryd

  • Hero Member
  • *****
  • Posts: 759
    • View Profile
    • Davcomm
    • Email
Re: Bypassing read-only fields
« Reply #1 on: April 15, 2014, 04:23:49 AM »
Thanks Keith
Feedback always helps.
Terry Davidson
Windows 10 64 bit/Windows7 64bit
Clarion 9.1.11529/Clarion10 12567
Nettalk 913
Nettalk 1015
StringTheory267/Winevent515/XFiles298/MessageBox239/Cryptonite186