|
Register or have you forgotten your password?
|
|
|
| Amiga OS -- Development This particular forum deals with issues regarding development for all versions of AmigaOS. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 | ||||||||
|
Cult Member
![]()
|
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 } |
||||||||
|
|
|
|
|
#2 | ||||||||
|
Defender of the Faith
![]()
Join Date: Oct 2002
Posts: 1,874
|
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_ |
||||||||
|
|
|
|
|
#3 | |||||||||
|
Cult Member
![]()
|
Quote:
|
|||||||||
|
|
|
|
|
#4 | ||||||||
|
Premium Member
Join Date: Nov 2003
Location: Houston, Texas
Posts: 2,257
|
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 |
||||||||
|
|
|
|
|
#5 | ||||||||
|
Cult Member
![]()
|
are you trying to help or what? I havent changed any colours.. the cursor doesnt move.. I've checked for same colour text already.
|
||||||||
|
|
|
|
|
#6 | |||||||||
|
Premium Member
Join Date: Nov 2003
Location: Houston, Texas
Posts: 2,257
|
Quote:
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 |
|||||||||
|
|
|
|
|
#7 | |||||||||
|
Cult Member
![]()
|
Quote:
|
|||||||||
|
|
|
![]() |
| Bookmarks |
| Tags |
| text , string , dev , gadget |
| Thread Tools | |
| Display Modes | |
|
|
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 |