Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
26 user(s) are online (13 user(s) are browsing Forums)

Members: 0
Guests: 26

more...

Support us!

Headlines

 
  Register To Post  

« 1 (2)
Re: texteditor.gadget and copy/paste
Home away from home
Home away from home


See User information
With window class windows you need to add a idcmphook, WINDOW_IDCMPHook or similar (away from any amiga to check) search window class auto doc.

You might need to set the gadgets ICA_TARGET to the window, check includes for correct values, should be obvious

Go to top
Re: texteditor.gadget and copy/paste
Home away from home
Home away from home


See User information
@broadblues
Quote:

should be obvious


Not sure if it all that obvious, but while i got it, still will share some info as maybe someday someone else will search amigans.net for that info.

So, i was told today by Dan that we do have actually 2 methods of using ICA_*. After some digging and testing that indeed few ways : One is just when you create a map, like:

struct TagItem button_to_string_map[] = {
    {
GA_SelectedMYTAG_UPDATE},
    {
MYTAG_UPDATE, (ULONG)"Button Fucked !"},
    {
TAG_END0}
};


and then:

/* Create String gadget */
    
Object *string_gadget IIntuition->NewObject(StringClassNULL,
        
GA_IDGID_STRING,
        
GA_RelVerifyTRUE,
        
STRINGA_TextVal"Initial Text",
        
STRINGA_MaxChars256,
        
TAG_END);

    if (!
string_gadget) {
        
IDOS->Printf("Failed to create String gadget.\n");
        goto 
cleanup;
    }

    
/* Create Button gadget with ICA_TARGET and ICA_MAP */
    
Object *button_gadget IIntuition->NewObject(ButtonClassNULL,
        
GA_IDGID_BUTTON,
        
GA_RelVerifyTRUE,
        
GA_Text"Click Me",
        
ICA_TARGETstring_gadget/* Send OM_UPDATE to String gadget */
        
ICA_MAPbutton_to_string_map/* Map GA_Selected to MYTAG_UPDATE */
        
TAG_END);



This way winObj have no needs to have any IDCMP_IDCMPUPDATE/WINDOW_IDCMPHook/etc flags, and it works as OM_UPDATE.


Then, another way is like you say : creating an IDCMPHook, via adding to main window object like:

WINDOW_IDCMPHook,&idcmphook,
WINDOW_IDCMPHookBits,IDCMP_IDCMPUPDATE,


And then while our main loop is still reaction based with != WMHI_LASTMSG, we in the hook do:

switch (imsg->Class)
        {
    case 
IDCMP_IDCMPUPDATE:
        switch (
GetTagData (GA_ID,0,imsg->IAddress))
            {
        case 
GID_blablba:
                           .......

            break;
            }
        break;
        }



Surely first way give not much control , just an information, but maybe that also enough ?

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: texteditor.gadget and copy/paste
Just can't stay away
Just can't stay away


See User information
@kas1e

Not sure what you are trying to do, but if it's just connecting a vertical scroller to a texteditor you can just do:

SetAttrs(textEditorObject,
         
GA_TEXTEDITOR_VertScrollerscrollerObject,
         
TAG_END);


and the text editor class will handle updating the scroller as necessary, as well as setting ICA_TARGET and ICA_MAP so that it gets updates from the scroller when it's moved.

Go to top
Re: texteditor.gadget and copy/paste
Home away from home
Home away from home


See User information
@salas00
Turns out that was it :) Went through custom scrollbar logic, ICA_* attributes, and hook setup — only to realize it all boiled down to a single string of code..

@all
Any ideas on properly loading large binary files (more than 100mb) into texteditor.gadget? Issue is that null bytes (0x00) get treated as string terminators, so content gets truncated. Notepad and MultiEdit seem to handle this: they not only skip 0x00 but also appear to skip something else too, and that no isprint() from ctype.h.

I currently just skip 00 but curious how Notepad do. It's more than isprint() filtering for sure — they skip additional chars.

Also, what’s the proper way to load a file via DOS these days? I mean modern with all the things way. Currently use:

IDOS->FOpen
IDOS->GetFileSize
IDOS->Read

But maybe that all dated already..

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top

  Register To Post
« 1 (2)

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project