How do you set and use these events?GA_TEXTEDITOR_AreaMarked (BOOL)
This tag will be set to TRUE when text is marked and back to
FALSE when nothing is marked.
You can create a notifyevent with this tag and let your
cut/copy buttons become ghosted when nothing is marked.
Applicability is (OM_GET, OM_NOTIFY)
texteditor.gadget notifyevent
texteditor.gadget notifyevent
Workbench Explorer - A better way to browse drawers
- salass00
- AmigaOS Core Developer
- Posts: 530
- Joined: Sat Jun 18, 2011 3:12 pm
- Location: Finland
- Contact:
Re: texteditor.gadget notifyevent
It's not supposed to be set by you. You can use the notification on the attribute to enable and disable any menu items or buttons you have that depend on an area of text being selected (Copy, Cut, a.s.o.) as appropriate.
To get notifications as idcmp messages to your window you have to set the gadget's ICA_TARGET to ICTARGET_IDCMP. In addition if you are using ReAction's window.class you have to use an idcmp hook to catch the IDCMP_IDCMPUPDATE messages.
To get notifications as idcmp messages to your window you have to set the gadget's ICA_TARGET to ICTARGET_IDCMP. In addition if you are using ReAction's window.class you have to use an idcmp hook to catch the IDCMP_IDCMPUPDATE messages.
- broadblues
- AmigaOS Core Developer
- Posts: 600
- Joined: Sat Jun 18, 2011 2:40 am
- Location: Portsmouth, UK
- Contact:
Re: texteditor.gadget notifyevent
I do something like this in my IDCMPHook for MultiEdit
Then inside those SetupGadgets() SetMEMenuState() functions I get the value of the tag like so
GetAttr(GA_TEXTEDITOR_AreaMarked,(Object *)(*editorgad_ptr),&attr);
Note the editotgad_ptr is an abstracted pointer to pointer to the editorgad to deal with my Tabbed layout having many possible editor instances you most likely need just anormal pointer to object so don;t get confused by that....
Code: Select all
case IDCMP_IDCMPUPDATE:
{
gid = 0;
gid=GetTagData(GA_ID,0,(struct TagItem *)msg->IAddress);
switch((gid))
{
case ME_GAD_EDITORGAD:
{
BOOL haschanged = FALSE;
.
.
.
haschanged = GetTagData(GA_TEXTEDITOR_AreaMarked,fd->fd_CurrentFile->fn_Marked,(struct TagItem *)msg->IAddress);
if(haschanged != fd->fd_CurrentFile->fn_Marked)
{
fd->fd_CurrentFile->fn_Marked = haschanged;
SetupGadgets(me);
SetMEMenuState(me);
}
.
.
.
.
GetAttr(GA_TEXTEDITOR_AreaMarked,(Object *)(*editorgad_ptr),&attr);
Note the editotgad_ptr is an abstracted pointer to pointer to the editorgad to deal with my Tabbed layout having many possible editor instances you most likely need just anormal pointer to object so don;t get confused by that....