amiga.org
     
iconAll times are GMT -6. The time now is 04:05 PM. | Welcome to Forum, please register to access all of our features.

» Amiga.org » Operating System Specific Discussions » Amiga OS » Amiga OS -- Development » dev: no text in string gadget

Amiga OS -- Development This particular forum deals with issues regarding development for all versions of AmigaOS.

Reply
 
Thread Tools Display Modes
Old 01-11-2004, 04:10 PM   #1
jahc
Cult Member
Points: 10,931, Level: 69 Points: 10,931, Level: 69 Points: 10,931, Level: 69
Activity: 4% Activity: 4% Activity: 4%
 
jahc's Avatar
 
Join Date: Mar 2002
Posts: 524
Send a message via MSN to jahc
Default dev: no text in string gadget

I posted this message on the AmigaC mailing list.. I've reposted here as there have been no responses yet:

I've created a custom string gadget editing hook, but it wont display text in my string gadget while I type.. but when I hit enter, the text is printed in my windows listbrowser alright. So the text is being stored somewhere, but not displayed.. I'm using a Reaction
string gadget. Heres the relevant parts to my program.. I hope it makes sense. Btw this hook is just a test hook, I will be make it do other stuff later..


#define SG_STRLEN 600

struct Vars
{
struct StringInfo sgg_StrInfo;
struct StringExtend sgg_Extend;
struct Hook sgg_Hook;

UBYTE sgg_Buff[SG_STRLEN];
UBYTE sgg_WBuff[SG_STRLEN];
UBYTE sgg_UBuff[SG_STRLEN];
} *vars;


ULONG str_hookRoutine(struct Hook *hook, struct SGWork *sgw, ULONG
*msg)
{

UBYTE *work_ptr;
ULONG return_code;

/* Hook must return non-zero if command is supported.
** This will be changed to zero if the command is unsupported.
*/
return_code = ~0L;


if (*msg == SGH_KEY)
{

if ((sgw->EditOp == EO_REPLACECHAR) ||
(sgw->EditOp == EO_INSERTCHAR))
{
if((int)sgw->Code == 66) sgw->WorkBuffer[sgw->BufferPos -
1] = 'Z'; else
sgw->WorkBuffer[sgw->BufferPos - 1] = (int)sgw->Code;

}
}

else if (*msg == SGH_CLICK)
{
/* mouse click
** zero the digit clicked on
*/
if (sgw->BufferPos < sgw->NumChars)
{
work_ptr = sgw->WorkBuffer + sgw->BufferPos;
*work_ptr = '0';
}
}

else
{
/* UNKNOWN COMMAND
** hook should return zero if the command is not supported.
*/


return_code = 0;
}

return(return_code);
}


#define ASM __asm
#define REG(x) register __ ## x

ULONG ASM
hookEntry(REG(a0) struct Hook *h, REG(a2) VOID *o, REG(a1) VOID *msg)
{
return ((*(ULONG (*)(struct Hook *,VOID *,VOID *))(h->h_SubEntry))
(h, o, msg));
}


/* This simple function is used to initialize a Hook */
VOID InitHook (struct Hook *h, ULONG (*func)(struct Hook *hook,
struct SGWork *sgw, ULONG *msg), VOID *data)
{
/* Make sure a pointer was passed */
if (h)
{
/* Fill in the Hook fields */
h->h_Entry = (ULONG (*)()) hookEntry;
h->h_SubEntry = (HOOKFUNC)func;
h->h_Data = data;
}
}

struct Gadget *string_gadget;

int main()
{

(snipped large LAYOUT gadget stuff)
LAYOUT_AddChild, string_gadget =(Gadget*) StringObject,
STRINGA_MaxChars, 600,
GA_RelVerify, TRUE,
GA_UserInput, TRUE,
LAYOUT_DeferLayout, TRUE,
GA_ID, 1,
StringEnd, LayoutEnd;
(/snipped large LAYOUT gadget stuff)

vars = (struct Vars *)AllocMem(sizeof(struct Vars),MEMF_CLEAR);

if (vars != NULL)
{


vars->sgg_Extend.EditHook = &(vars->sgg_Hook);
vars->sgg_Extend.WorkBuffer = vars->sgg_WBuff;

vars->sgg_StrInfo.Buffer = vars->sgg_Buff;
vars->sgg_StrInfo.UndoBuffer = vars->sgg_UBuff;

vars->sgg_StrInfo.MaxChars = 600;
vars->sgg_StrInfo.Extension = &(vars->sgg_Extend);

string_gadget->Flags = GFLG_GADGHCOMP | GFLG_STRINGEXTEND;
string_gadget->SpecialInfo = &(vars->sgg_StrInfo);

InitHook (&(vars->sgg_Hook), str_hookRoutine, NULL);

//RA_SetUpHook(vars->sgg_Hook,string_gadget,NULL);

}

etc etc
}
jahc is offline   Reply With Quote
Old 01-11-2004, 05:40 PM   #2
itix
Defender of the Faith
Points: 11,740, Level: 71 Points: 11,740, Level: 71 Points: 11,740, Level: 71
Activity: 5% Activity: 5% Activity: 5%
 
itix's Avatar
 
Join Date: Oct 2002
Posts: 1,874
Default Re: dev: no text in string gadget

I don't know much of Intuition programming but I suspect you must
set SGA_USE flag there...

sgw->Actions |= SGA_USE;

(RKRM / Custom String Editing / Actions with SGH_KEY)
__________________
Only MorphOS makes it possible \o_
itix is offline   Reply With Quote
Old 01-11-2004, 07:56 PM   #3
jahc
Cult Member
Points: 10,931, Level: 69 Points: 10,931, Level: 69 Points: 10,931, Level: 69
Activity: 4% Activity: 4% Activity: 4%
 
jahc's Avatar
 
Join Date: Mar 2002
Posts: 524
Send a message via MSN to jahc
Default Re: dev: no text in string gadget

Quote:
I don't know much of Intuition programming but I suspect you must
set SGA_USE flag there...

sgw->Actions |= SGA_USE;
I've tried sgw->Actions |= SGA_USE; and sgw->Actions |= SGA_REDISPLAY; but neither of them makes a difference... :/

jahc is offline   Reply With Quote
Old 01-15-2004, 06:29 AM   #4
ChaosLord
Premium Member
Points: 14,695, Level: 78 Points: 14,695, Level: 78 Points: 14,695, Level: 78
Activity: 28% Activity: 28% Activity: 28%
 
ChaosLord's Avatar
 
Join Date: Nov 2003
Location: Houston, Texas
Posts: 2,257
Default Re: dev: no text in string gadget

Try setting the colors in your RastPort to sensible values.

Black text on a black background might be hard to read. :-D
__________________
Wanna try a wonderfull strategy game with lots of handdrawn anims,
Magic Spells and Monsters, Incredible playability and lastability,
English speech, etc. Total Chaos AGA
ChaosLord is offline   Reply With Quote
Old 01-15-2004, 09:24 PM   #5
jahc
Cult Member
Points: 10,931, Level: 69 Points: 10,931, Level: 69 Points: 10,931, Level: 69
Activity: 4% Activity: 4% Activity: 4%
 
jahc's Avatar
 
Join Date: Mar 2002
Posts: 524
Send a message via MSN to jahc
Default Re: dev: no text in string gadget

are you trying to help or what? I havent changed any colours.. the cursor doesnt move.. I've checked for same colour text already.
jahc is offline   Reply With Quote
Old 01-16-2004, 01:08 PM   #6
ChaosLord
Premium Member
Points: 14,695, Level: 78 Points: 14,695, Level: 78 Points: 14,695, Level: 78
Activity: 28% Activity: 28% Activity: 28%
 
ChaosLord's Avatar
 
Join Date: Nov 2003
Location: Houston, Texas
Posts: 2,257
Default Re: dev: no text in string gadget

Quote:
jahc wrote:
are you trying to help or what? I havent changed any colours.. the cursor doesnt move.. I've checked for same colour text already.
Well I had similar problem with Intuition(tm) before.
I didn't change any colors either.
It defaulted to color X text on color X background and was invisible.
I have never used Reaction.

Yes I was trying to help but since u don't appreciate it I won't help anymore. Bye.
__________________
Wanna try a wonderfull strategy game with lots of handdrawn anims,
Magic Spells and Monsters, Incredible playability and lastability,
English speech, etc. Total Chaos AGA
ChaosLord is offline   Reply With Quote
Old 01-16-2004, 02:59 PM   #7
jahc
Cult Member
Points: 10,931, Level: 69 Points: 10,931, Level: 69 Points: 10,931, Level: 69
Activity: 4% Activity: 4% Activity: 4%
 
jahc's Avatar
 
Join Date: Mar 2002
Posts: 524
Send a message via MSN to jahc
Default Re: dev: no text in string gadget

Quote:
Well I had similar problem with Intuition(tm) before.
I didn't change any colors either.
It defaulted to color X text on color X background and was invisible.
I have never used Reaction.

Yes I was trying to help but since u don't appreciate it I won't help anymore. Bye
Sorry, I thought you were just being smart. People have replied like that to me before. I appreciate all help btw.

jahc is offline   Reply With Quote
Reply

Bookmarks

Tags
text , string , dev , gadget

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Best Geek Gadget amigaoneproductions CH / Science and Technology 30 10-18-2006 08:35 PM
OS3.9 "Maximize" Gadget Button LinchpiN Amiga Software Issues and Discussion 12 06-01-2005 10:54 PM
texteditor.gadget ShawnBaxe Amiga OS -- Development 1 09-18-2004 11:29 AM
VisualPrefs: which gadget set used here? Lemonty Amiga Software Issues and Discussion 5 07-16-2004 12:32 PM
string gadget max chars jahc Amiga OS -- Development 4 11-20-2003 06:39 AM