how to do arrow left right xcode

please note total newbe to ibook one month in mac environment steep learning curve
and very close to useless java programmer having tried and studied it for two years :frowning:

opted to buy a apple as my friend had one and it lasted longer than my HP Intel laptop
then I started to use it and after a few days found something called XCODE cocoa

so yaba daba doo cocoa arrived made for useless coders like me I HOPE
problem is to learn and simultaneously introduce xcode into my project schedule

The project time line cant exceed two weeks as I need this component ASAP

The problem how toooo…

I want to have a initially a three choices going from left to right
( to be decided)
possibly radio buttons (but might settle on menus or other buttons)

which will have numbers on indicated( possibly on top of them -1,0 ,+1 or inside a text field or both)

the program will always start in the centre radio button highlighted and numbered zero
the left button will be numbered -1 and the right button will be numbered +1

below that there will be two arrows one pointing left and one pointing right
when you use the key board (mandatory requirement )
on the apple g4 ibook(purchased oct 2005) arrow keys left or right arrows

( will use z,x,c or similar F1… if arrow keys cant be used)

(or optional extra you mouse click the arrows on the relevant screen)

the highlighted radio button changes one position to the right or left
depending on the limit of three positions and the relevant instruction

If I can succeed to do this it will be extended to more than three positions
and will include a lot of extra features so that dictates
must be cocoa xcode objective c (possibly carbon or java)
as apposed to script

If somebody want too help out the real problem I have from converting
from my limited two years of java is how to tackle this type of logic
I figure I could probably crack this problem switching directly to
objective c and then doing carbon and later converting over to cocoa

Life’s too short and the idea to do little preferably NO CODE appeals to me
but I cant get my head around how to tackle the problem in a logical way
that suits cocoa
I have studied as best as possible all relevant examples such as converter and calculator
also a lot of other cocoa examples on the net and some scripts
the best script I found that code might be usable was the program
ā€œMINEā€
by jonn8 (that’s an excellent site he has best I found yet lot of useful small programs)

As a code hacker reuse and modifier of code to do something else there seems to be a real
lack of useful information on how to tackle this new type of environment which requires very little code

My best stab to date suggests I might probably be using classes and methods such as these

class NSActionCell ( if I use a menu or cell instead of radio button)
class NSBrowserCell ( if I use a menu or cell instead of radio button)
NSTableView ( if I use a menu or cell instead of radio button)

class NSResponder ( moveLeft moveRight methods )
class NSControl ( select method )
class NSButon ( highlight method )

    NSTableView   -(  selectColumIdexes:byExtendingSelection(*)   example (num-1)     method)
    NSTableDataSource

class NSObject

The mechanics of the xcode I can work with so far with most examples

Its the how to do the project when there is no code to cannibalize…

If I can get a way to solve this typical problem then I might be able to extend this type method to other future projects

Info on other sources or best practices sites etc all welcome

I prefer to have this section of the project completed by the end of the week
but if some old hands figure to use carbon or java would solve the problem quicker for the moment
then I will opt for that route as a temporary measure until I can figure out this cocoa stuff

If somebody knows a relevant how too for a similar project that would probably be best
as just supplying me the code might not supply the logic of how to solve this problem

My instincts suggest that there may be no code needed to do this section of the project

Codeless2


I have a dream NO MORE CODE planet
and especially no more quirky expensive WINDOWS X…

Codeless2;
While you’re certainly correct that Jonn8 (Jon Nathan) is a wonderful resource for AppleScripts, you may have missed that MacScripters.net has many more sections than this forum and a huge number of resources for learning scripting. See some of the sections below for examples that will help you, then break your questions to the forum down to simpler one-at-a-time problems.

ScriptBuilders is a source of ready-made scripts to do a thousand things (some of them from Jonn8, btw)
OSAXen are tools to extend and enrich AppleScripting. They are typically written in c and you put them in your Users/Library/ScriptingAdditions folder.
UnScripted, in the bbs here, has some very nice tutorials on how to script things.
The AppleScript FAQ, also here in the bbs, contains a series of expositions by Julio Sanchez that are an excellent beginning on how things are done.
The Code Exchange here in the forum pages is a collection of useful snippets; ways to do things.
And finally, the Section Finder, found on every page (on this one it’s in the menu on the right near the top of the page), will help you navigate among these.

Happy Scripting, and welcome to the Mac Scripting community!

Adam Bell
I had just found sections and scriptable Applications and was wading in there lots of stuff:D

I will continue to check out the other leads

All info greatly appreciated

Codeless2


I have a dream NO MORE CODE planet
and especially no more quirky expensive WINDOWS X…

Mayby its best to explain what dosnt work

using currency convertor example
put three textfields on to a window
reduce them in size to small boxxes
put them side by side left to right
put a number over each text box left is -1 middle is 0 and right is +1
build and run
this will HIGHLIGHTED tab right and shift tab left
I cant find a way to allocate that arrow key left should tab left or arrow right tabs right
I cant find a way to allocate key z is tab left or key c should tab right
I cant find a way to ensure that program starts with middle textfield highlighted

so question
should I change to radio buttons or buttons or menu…
or is it impossible

Codeless2


I have a dream NO MORE CODE planet
and especially no more quirky expensive WINDOWS X…

Hi Codeless 2,

I am also a newbie to AS Studio but I’ve had problems similar to yours so let me see if I can be of some help.

I wanted buttons that showed images in it as titles (like an arrow in your case, for example). To be able to do that, I created buttons in window ā€œmainā€ and then set the title of the buttons to some Unicode characters that correspond to my desired images. I think you can find left and right arrow keys in the International menu in System Prefs that might be useful for you. You can check the utxt code in the character palette when you find the desired image.

When you have the utxt codes for the images then you are almost home. Build your buttons and then link them up to the AppleScript codes like below:

on awake from nib
set myArrow1 to «data utxt2668» as Unicode text
set myArrow2 to «data utxt266C» as Unicode text

tell window ā€œmainā€
set title of button ā€œleftArrowā€ to myArrow1 as Unicode text
set title of button ā€œrightArrowā€ to myArrow2 as Unicode text
end tell
end awake from nib

Note that the «data utxt2668» and «data utxt266C» correspond to images that will appear in your buttons. They are provided here only as example. You will have to find the correct code for your left and right arrows.

When you have the buttons all set up with your left and right arrows, then link them to whatever tasks they are supposed to do in your script. In the Interface Builder, you can also give the buttons the alternate keyboard commands.

As for the numbers above the buttons, you should be able to build them using text fields that stores the desired numbers.

I hope the above helps. I used the above trick in the absence of a suitable workaround. Perhaps you may find a good solution if you look hard. Please share if you do. I am always looking to improve.

Ciao.

archseed :slight_smile:

THANKS archseed
I will run with that and see where it goes

If I find a solution I will put it up here and in the relevant code project pages

its the small gremlins that block the show

Codeless2


I have a dream NO MORE CODE planet
and especially no more quirky expensive WINDOWS X…

Codeless2,

Just another thought in case things don’t work out well for you with the previous suggestion. However, I know that tip does work as it has worked for me before. The only constraint that I can foresee is if you can’t find the right images with the corresponding utxt code. Sometimes, the image may be there but the code does not work in AppleScript. This possibility is real as I have tried some which responded this way.

The other thought (wild may be?) is to still go with button. Build a custom text field (NSView) resized to the size of your button and with the image you want. Put that custom text field on top of your button then send it to back. The button should show the image even if the image is behind the view. When you click the button with the image seemingly built into its surface, the button should respond to the click.

Note: I haven’t tried this yet but you may consider it as another line of your experimentation especially if the previous tip does not work for you.

Good luck!

archseed :o