Computing.Net > Forums > PDAs > Palm Programming Problem

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Palm Programming Problem

Reply to Message Icon

Name: Shane
Date: February 24, 2003 at 10:41:47 Pacific
OS: Palm OS 4.0
CPU/Ram: 8mb
Comment:

Hi There,

I'm having a little problem with my code. What I'm developing is a tourist information guide for a palm pilot. Ok, here's the code. I've declared a struct in my .h file.

typedef struct
{
char Category_choice[20];
} ChoiceDB;

In my .c file I'm storing a string from a list into the struct and saving it in memory.

//global variables in the .c file
MemHandle Mem_Handle, ShopsHandle;
char *Amenity;
ChoiceDB *choice_record;

This code below is in a function which gets the string from the list, saves it in the struct and then goes to another form. The code for this form is in the same .c file.

AmenityList = GetObjectPtr(AmenitiesShopsList);
Amenity = LstGetSelectionText(AmenityList, LstGetSelection(AmenityList));

// Allocate memory for a structure
Mem_Handle = MemHandleNew(sizeof(ChoiceDB));
choice_record = MemHandleLock(Mem_Handle);
StrCopy(choice_record->Category_choice, Amenity);
MemHandleUnlock(Mem_Handle);
FrmGotoForm(AmenitiesDetailsForm);

The code below is executed when the AmenitiesDetailsForm is opened.

char amenity_choice[20];

choice_record = MemHandleLock(Mem_Handle);
StrCopy(amenity_choice, choice_record->Category_choice);
MemHandleUnlock(Mem_Handle);
MemHandleFree(Mem_Handle);

if(amenity_choice=="Pub")
{
WinDrawChars("Woop-di-do", StrLen("Woop-di-do"), 80,90);
}

This string that I'm getting from the list is called "Pub". I'm able to get the length of the string and it comes up as 3 so the string is correct. But the problem is, is that the if statement isn't working. It doesn't seem to recognise the string "Pub" which is coming from the list in the other form. Is the problem with the array amenity_choice and using an if statement with it. This is the only thing that's stopping me at the moment.

Any help would be greatly appreciated.
Thanks,
Shane Fleming



Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to PDAs Forum Home


Sponsored links

Ads by Google


Results for: Palm Programming Problem

Palm Programming www.computing.net/answers/pda/palm-programming/314.html

Palm HotSync Problems www.computing.net/answers/pda/palm-hotsync-problems/721.html

Hotsync problem (Palm m515) www.computing.net/answers/pda/hotsync-problem-palm-m515/1498.html