Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Static Text- Updating in Windows/Dialogs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Static Text- Updating in Windows/Dialogs



I'm sending this to both lists in the hope of receiving a small clue... any clue.

Problem:
Unable to programmatically update static text boxes in the UI dialogs/windows in a game. Interface Builder was used to create the UI from a pre-existing resource file.

Background:

The game was written years ago and was never fully updated to PPC much less OS X. I am now attempting to do this (to OS X). The source code I'm working with is not the source for the version that presently runs under Classic (which no longer exists) but is a partial attempt on upgrading. It no longer will compile to either 68k, CFM or Mach-0. Which simply means that I don't know how buggy the source is I'm working with under any system. I am not the original author, just attempting to port it to OS X mach-o.

The game is an RPG with no animation but some scrolling (h and v) of the playing field. The game generates a great deal (internally) of data about the characters, their possessions, vital statistics, weapons and magic spells. Each of these, in turn, also possess data on their properties. There are, in addition, monsters, shops and complex events that each have internal structure (programmatically, many data types of type 'struct') that are displayed/presented to the player in dialogs/windows in static text boxes.

This data is dynamic and changes as the game is played and the characters progress and evolve. Thus the information needs to be updated whenever the player accesses the information (which is very frequent.)

There are over 60 dialogs (DLOG's) that convey this info to the player. There is anywhere from 4 to 30 or so static text boxes in each DLOG. All need to be updated each time the player requests a DLOG.

What I have done:

I used IB to bring over all the dialogs in the resource file for the game (it is a separate file and not in the resource fork of the app) so all the dialogs are now in nibs imbedded in nib file windows. IB imported all without trouble.

What IB has done:

Each static text box had a number assigned to it in the old resource file. This number is now associated with the numeric part of the static text control's ID. Additionally, the content of the static text boxes are now associated with Their IB 'Title' reference.

What I can't do (and need help with):

I am now attempting to programmatically update the static text boxes in the new IB nib windows. Nothing seems to work. Without being able to do this I am at a loss as to how to create the UI for this game that is so heavily dependent on being able to do so.

What I have tried:

In outline, these are the methods I've tried. All compile, all create a clean debug log when run and none display a window with updated static text boxes. The windows are displayed but not with the updated info.

Method 1:

err = GetControlByID( window, &idcontrol, &control );
err = SetControlTitleWithCFString( control, data);

Method 2:

err = GetControlByID( window, &idcontrol, &control );
GetControlBounds(control , &grect);
EraseRect(&grect);
err=TXNDrawCFStringTextBox( CFSTR("just great"), &grect,nil,nil);

Method 3:

gCurrent = GetDialogFromWindow( window );
GetDialogItem(gCurrent,theItem,&itemType,&itemHandle,&itemRect);
SetDialogItemText(itemHandle,myString);
window = GetWindowFromDialog(gCurrent);

Remember, these are the approaches and not the full code. The full background code compiles and runs bug free but does not display the changes. I do 'ShowWindow( window ). And I've tried it many ways and times.

I am stumped... help??!

Skip
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Mac-games-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.