Underline text on GEM textbox

Moderators: exxos, simonsunnyboy, Mug UK, Zorro 2, Moderator Team

User avatar
exxos
Hardware Guru
Hardware Guru
Posts: 4933
Joined: Fri Mar 28, 2003 8:36 pm
Location: England
Contact:

Underline text on GEM textbox

Postby exxos » Thu Dec 24, 2015 11:47 am

I have a RSC file with my text in. I can change the text in my program. Though how the heck does underline work in a text box ?

I can output "Hello" to my textbox, though do I just split that up and send control codes to get the underline to work ?

Such as

"H"+chr(xx)+"E"+chr(xx)+"LLO"

I'm not totally sure there is a control code for underlining (I think so) but is that method correct anyway or is there some other "proper" way to do it ?
4MB STFM 1.44 FD- VELOCE+ 020 STE - Falcon 030 CT60 - Atari 2600 - Atari 7800 - Gigafile - SD Floppy Emulator - PeST - various clutter

http://www.exxoshost.co.uk/atari/ All my hardware guides - mods - games - STOS
http://www.exxoshost.co.uk/atari/last/storenew/ - All my hardware mods for sale - Please help support by making a purchase.
http://ataristeven.exxoshost.co.uk/Steem.htm Latest Steem Emulator

User avatar
mfro
Atari Super Hero
Atari Super Hero
Posts: 674
Joined: Thu Aug 02, 2012 10:33 am
Location: SW Germany

Re: Underline text on GEM textbox

Postby mfro » Thu Dec 24, 2015 11:57 am

exxos wrote:I have a RSC file with my text in. I can change the text in my program. Though how the heck does underline work in a text box ?

I can output "Hello" to my textbox, though do I just split that up and send control codes to get the underline to work ?

Such as

"H"+chr(xx)+"E"+chr(xx)+"LLO"

I'm not totally sure there is a control code for underlining (I think so) but is that method correct anyway or is there some other "proper" way to do it ?


There is no functionality like that in standard GEM besides USERDEFs (no control code nor any other "trick" to underline AES texts). USERDEFs are AES objects that callback user code that draw these objects using the VDI (http://toshyp.atari.org/en/008002.html search for USERDEF).

User avatar
exxos
Hardware Guru
Hardware Guru
Posts: 4933
Joined: Fri Mar 28, 2003 8:36 pm
Location: England
Contact:

Re: Underline text on GEM textbox

Postby exxos » Thu Dec 24, 2015 12:12 pm

mfro wrote:There is no functionality like that in standard GEM besides USERDEFs (no control code nor any other "trick" to underline AES texts). USERDEFs are AES objects that callback user code that draw these objects using the VDI (http://toshyp.atari.org/en/008002.html search for USERDEF).


Nothing ever simple :roll:

I can draw all sorts with VDI texts. I wonder if it would be simple just to get the XY locations of the text on screen and just paste over it with VDI text :shrug:
4MB STFM 1.44 FD- VELOCE+ 020 STE - Falcon 030 CT60 - Atari 2600 - Atari 7800 - Gigafile - SD Floppy Emulator - PeST - various clutter

http://www.exxoshost.co.uk/atari/ All my hardware guides - mods - games - STOS
http://www.exxoshost.co.uk/atari/last/storenew/ - All my hardware mods for sale - Please help support by making a purchase.
http://ataristeven.exxoshost.co.uk/Steem.htm Latest Steem Emulator

User avatar
wongck
Ultimate Atarian
Ultimate Atarian
Posts: 11976
Joined: Sat May 03, 2008 2:09 pm
Location: Far East
Contact:

Re: Underline text on GEM textbox

Postby wongck » Thu Dec 24, 2015 12:28 pm

exxos wrote:I can draw all sorts with VDI texts. I wonder if it would be simple just to get the XY locations of the text on screen and just paste over it with VDI text :shrug:

That's what you can do with USERDEF. It's will call your code to and you can draw whatever you need with VDI text, circles etc.
It is really that easy.
My Stuff: FB/Falcon CT63+CTPCI_ATI_RTL8139 14+512MB 30GB HDD CF HxC_SD/ TT030 68882 4+32MB 520MB Nova/ 520STFM 4MB Tos206 SCSI
Shared SCSI Bus:ScsiLink ethernet, 9GB HDD,SD-reader @ http://phsw.atari.org
My Atari stuff for sale - click here for list

User avatar
mfro
Atari Super Hero
Atari Super Hero
Posts: 674
Joined: Thu Aug 02, 2012 10:33 am
Location: SW Germany

Re: Underline text on GEM textbox

Postby mfro » Thu Dec 24, 2015 12:50 pm

exxos wrote:Nothing ever simple :roll:

USERDEFs are pretty simple once you get familiar. Basically it's just: define a placeholder in the RSC file, mark it as USERDEF, create a USERBLK structure within your program (which points to your drawing code) and set the ob_spec member of your placeholder to point to your USERBLK. The rest will be done by the AES.

The real art with USERDEFs is to avoid exaggeration. Only use them if there is no standard way to achieve the same thing. You didn't mention yet what your aim is?

exxos wrote:I can draw all sorts with VDI texts. I wonder if it would be simple just to get the XY locations of the text on screen and just paste over it with VDI text :shrug:


This would probably be possible, but I'd call that a (very) bad hack. You can't really tell (well, you can, but that would require a lot of work) when the AES decide to redraw the underlying object and thus you never know when you would be required to smear over it. Also, with different AES, you'll probably never get this right for all of them.

GEM is a "layered" design and it's usually not a good idea to call lower level functions the upper layer isn't prepared for.

User avatar
exxos
Hardware Guru
Hardware Guru
Posts: 4933
Joined: Fri Mar 28, 2003 8:36 pm
Location: England
Contact:

Re: Underline text on GEM textbox

Postby exxos » Thu Dec 24, 2015 1:25 pm

Its to do with GemBench code. The main window with the results on is what I am trying to get working.

In the original code the RSC files has things like "GEM [DIALOG BOX" Where the "[" is used as some sort of switch so the next letter is replaced with a underlined letter.

I see this code..

Code: Select all

FOR tmp=res1 TO res3
   IF curob_state(tmp,mask_selected) THEN
      d$=LTRIM$(RTRIM$(getob_progdef_str$(tmp)))
      h=INSTR(d$,"[")
      IF h THEN d$=LEFT$(d$,h-1)+RIGHT$(d$,LEN(d$)-h)
      d$=", "+d$
   END IF
NEXT tmp


And

Code: Select all

FUNCTION getob_progdef_str$(BYVAL obj)
STATIC t&,a$
a$=""
t&=GetProgdefTextPtr&(obj)
WHILE PEEKB(t&)
   a$=a$+CHR$(PEEKB(t&))
   INCR t&
WEND
Getob_progdef_str$=a$
END FUNCTION


Probably a whole bunch of other related stuff somewhere. But GB code is very difficult to follow. It just falls into a nested heap of chaos. So trying to work out how to do things myself instead.

The code looks like it probably does as you suggest. So there must be something in place in the RSC file already somewhere. I used the original GB RSC file as a platform to build on, so it might give some more clues.

I will have a look in the hisoft manual, it must say something about USERDEF's somewhere.. At least now I know what I need to look for :)
4MB STFM 1.44 FD- VELOCE+ 020 STE - Falcon 030 CT60 - Atari 2600 - Atari 7800 - Gigafile - SD Floppy Emulator - PeST - various clutter

http://www.exxoshost.co.uk/atari/ All my hardware guides - mods - games - STOS
http://www.exxoshost.co.uk/atari/last/storenew/ - All my hardware mods for sale - Please help support by making a purchase.
http://ataristeven.exxoshost.co.uk/Steem.htm Latest Steem Emulator

User avatar
jfl
Atari Super Hero
Atari Super Hero
Posts: 821
Joined: Tue Jul 18, 2006 10:55 pm
Location: Liège, Belgium
Contact:

Re: Underline text on GEM textbox

Postby jfl » Thu Dec 24, 2015 1:38 pm

exxos wrote:

Code: Select all

FOR tmp=res1 TO res3
   IF curob_state(tmp,mask_selected) THEN
      d$=LTRIM$(RTRIM$(getob_progdef_str$(tmp)))
      h=INSTR(d$,"[")
      IF h THEN d$=LEFT$(d$,h-1)+RIGHT$(d$,LEN(d$)-h)
      d$=", "+d$
   END IF
NEXT tmp

The code looks like it probably does as you suggest

Yes, PROGDEF is another term for USERDEF.
Jean-François
GEMDict – GEMClip

User avatar
exxos
Hardware Guru
Hardware Guru
Posts: 4933
Joined: Fri Mar 28, 2003 8:36 pm
Location: England
Contact:

Re: Underline text on GEM textbox

Postby exxos » Thu Dec 24, 2015 5:44 pm

I found this code in a example file. Looks like it literally draws a line under text..

That would actually be something I could do, somewhere I have found the XY locations on the screen, so could work out where to draw the lines that way. Not sure why its checking AES version in there though.

Code: Select all

SUB draw_underline(BYVAL object,BYVAL x1,BYVAL y1,BYVAL x2)
STATIC drawlines(),x,y,w,h,dummy

DIM drawlines(3)
vsl_color 2
IF enquire_state(object,mask_selected) THEN
   IF (getobj_flags(object) AND mask_3d)=fl3dact THEN
      IF aes_version>=&h340 THEN INCR x1 : INCR x2
   END IF
END IF
drawlines(0)=x1 : drawlines(1)=y1 : drawlines(2)=x2 : drawlines(3)=y1
dummy=getobj_parent(object)
DO
   IF enquire_flags(dummy,mask_hidetree) THEN
      ERASE drawlines : EXIT SUB
   ELSE
      dummy=getobj_parent(dummy)
   END IF
LOOP UNTIL dummy=<0
v_pline 2,drawlines()
ERASE drawlines
END SUB
4MB STFM 1.44 FD- VELOCE+ 020 STE - Falcon 030 CT60 - Atari 2600 - Atari 7800 - Gigafile - SD Floppy Emulator - PeST - various clutter

http://www.exxoshost.co.uk/atari/ All my hardware guides - mods - games - STOS
http://www.exxoshost.co.uk/atari/last/storenew/ - All my hardware mods for sale - Please help support by making a purchase.
http://ataristeven.exxoshost.co.uk/Steem.htm Latest Steem Emulator

User avatar
wongck
Ultimate Atarian
Ultimate Atarian
Posts: 11976
Joined: Sat May 03, 2008 2:09 pm
Location: Far East
Contact:

Re: Underline text on GEM textbox

Postby wongck » Sat Dec 26, 2015 12:49 am

Use USERDEF as call back, you can easily find the XY location where to draw the box.
The dialogbox you know where it is on the screen as you put it there yourself.
use object_offset to find the USEDEF object XY position on screen.
My Stuff: FB/Falcon CT63+CTPCI_ATI_RTL8139 14+512MB 30GB HDD CF HxC_SD/ TT030 68882 4+32MB 520MB Nova/ 520STFM 4MB Tos206 SCSI
Shared SCSI Bus:ScsiLink ethernet, 9GB HDD,SD-reader @ http://phsw.atari.org
My Atari stuff for sale - click here for list

User avatar
jfl
Atari Super Hero
Atari Super Hero
Posts: 821
Joined: Tue Jul 18, 2006 10:55 pm
Location: Liège, Belgium
Contact:

Re: Underline text on GEM textbox

Postby jfl » Sat Dec 26, 2015 7:17 am

wongck wrote:Use USERDEF as call back, you can easily find the XY location where to draw the box.
The dialogbox you know where it is on the screen as you put it there yourself.
use object_offset to find the USEDEF object XY position on screen.

You don't even need this (and I don't think you can call the AES within a USERDEF callback). The PARMBLK structure contains all that information.
Jean-François
GEMDict – GEMClip


Social Media

     

Return to “Other BASIC”

Who is online

Users browsing this forum: No registered users and 1 guest