Solved

ResEdit

Posted on 1998-09-28
4
326 Views
Last Modified: 2013-12-26
Hi
I have created a dialog box in ResEdit, it consists of username and password text fields and a series of checkboxes. The dialog box is called by an AppleScript via the Scripting Addition "DialogRunner".
In ResEdit I want to change the Font used in the password field so that all characters display as bullets. I have found a custom FONT resource from another application which uses a password field in one of its dialogs, so I can copy this resource into my ResEdit dialog. But I dont know what to do next. Any Help?????
0
Comment
Question by:gormenghast
  • 2
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
boonstra earned 100 total points
ID: 1291550
To change the font of a dialog item, you need to add an Item Color Table Resource ('ictb').  ResEdit, unfortunately, can create/edit these resources only in hex.  If you have Resorcer, it can create them via a GUI.  Assuming you have only ResEdit, you'll need to go to Mac Toolbox Essentials to get the ictb format.  You can get this at <http://developer.apple.com/techpubs/mac/Toolbox/Toolbox-2.html>.  The ictb resource is described in the Dialog Manager chapter on page 6-158.  The format is too difficult to describe here, but here is what it looks like for a DLOG / DITL resource pair (128) with a single edit text item.  The ictb resource has the same resource ID as the DITL.  To change the edit text item font to Times 10, the ictb looks like:

0000: 8007  Item data, change font, typeface, font size
0002: 0004  Item offset to text style table
            (start of text style table)
0004: 0018  typeface offset
0006: 0000  font style 0
0008: 000A  font size 0x0A
000A: 0000  red text color component
000C: 0000  green text color component
000E: 0000  blue text color component
0010: FFFF  red text bkgd component
0012: FFFF  green text bkgd component
0014: FFFF  blue text bkgd component
0016: 0000  text mode (1==srcOr, etc.)
0018: 0554  "\pTimes"
001A: 696D
001C: 6573

If bit 15 of the item data is not set, then the typeface field contains the number of a font family instead of an offset to a typeface name.  This is what I would recommend for you, although that means you need to create a FOND resource as well
0
 
LVL 2

Author Comment

by:gormenghast
ID: 1291551
Hi
I am afraid this is beginning to look a bit too complicated for me. I am not familiar with Hex. I checked out the dialog manager chapter you mention, but need a bit more elementary guidance.
Is it possible to change the font information for individual edit text items rather than all. If so how do you specify each one, is this something to do with item offsets. I am probably asking a bit too much here but I was hoping this was going to be something easy to acheive as it appears so often in application dialogs.
I have looked at other applications which use password fields etc in ResEdit but it has not helped much. From one application I found a FONT resource containing a diamond shaped bitmap font.
The resource is as follows:

3200      0 Font Family: .Pwd
3212      200 .Pwd 12

There was however no corresponding FOND resource.
Also in this particular app there is no DITL for the main dialog which uses the password field.

I have not got resorceror, are there any other GUI editors available? I have searched the internet and downloaded some documentation (http://developer.apple.com/techpubs/mac/pdf/ResEditReference.pdf).

The other option I have is to take all my scripting into Facespan and build a dialog here, then I can catch the keystrokes in the text field etc. I really dont want to do this however as it will run much slower than it does with a ResEdit dialog.

Hope you can help some more.
0
 
LVL 3

Expert Comment

by:boonstra
ID: 1291552
First, most applications that protect passwords by using bullets do so programmatically, by intercepting keyDown events and substituting a bullet character.  This has many advantages, including the fact that someone who Cuts the password and Pastes it into a text editor will not be able to see the password, whereas they would if all you do is change the font.

Your limitation is that you are not writing a program, and thus are limited to the features AppleScript gives you.  Nevertheless, it is possible to do what you want using the technique described above.  The app you describe almost certainly creates the DITL programmatically, on the fly, which is why you don't see it in a resource file.

It is possible to change the font on an item-by-item basis, either programmatically, or by the 'ictb' resource described in the original answer.

I'm not aware of any other resource editors besides ResEdit and Resorcerer.

I think we need to actually exchange files in order for me to be more helpful.  If you post your email address, I'll contact you privately.
0
 
LVL 2

Author Comment

by:gormenghast
ID: 1291553
Hi boonstra
Thanks again for being so helpful, I realise I am being a pest and a bit out of my depth. I will play around with the ictb resource and see if I can get my head round it.
I do understand the security concept you mention (cut & paste), but this is not a problem.
My email address is snorman@pavilion.co.uk.

0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now