Figure out which RichEditGadget is active ...

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by WolfgangS.

Hi !
i try to figure out which RichEditGadget is active. Is there a function who give me the right RichEditHadget ID/Handle ?


MFG
WolfgangS


What i did...

Code: Select all

#ID_MWindow.l =0    ; ID Mother Window
#ID_MPanel.l  =1    ; ID Mother Panel
#ID_Frame3d.l =2    ; ID Frame3d
dID_Rich.l    =500  ; dynamic ID RichGadget

hnd_MWindow.l =0
hnd_rich0.l   =0
hnd_rich1.l   =0

hnd_MWindow=OpenWindow(#ID_MWindow,100,100,640,480,#PB_Window_SystemMenu,"Bla")

If CreateGadgetList(WindowID())

  PanelGadget(#ID_MPanel,0,28,640,365)
  AddGadgetItem(#ID_MPanel,-1,"Info")
  Frame3DGadget(#ID_Frame3d,0,0,640,300,"bla",0)
  hnd_Rich0=OpenRichEdit(GadgetID(#ID_Frame3d),dID_Rich,0,0,635,290,"RichEdit No "+Str(dID_Rich)):dID_Rich+1

  AddGadgetItem(#ID_MPanel,-1,"Info")
  Frame3DGadget(#ID_Frame3d,0,0,640,300,"bla",0)
  hnd_Rich1=OpenRichEdit(GadgetID(#ID_Frame3d),dID_Rich,0,0,635,290,"RichEdit No "+Str(dID_Rich)):dID_Rich+1

  ClosePanelGadget()
Else : End
EndIf

Repeat
  Event=WaitWindowEvent()
  
  ;if ?????=hnd_Rich0         ; true if RichRadget 0 is ACTIVE
    If Event=#WM_CHAR
      beep_(1000,80)
    EndIf
  ;EndIf

  ;if ?????=hnd_Rich1         ; true if RichRadget 1 is ACTIVE
    If Event=#WM_CHAR
      beep_(2000,80)
    EndIf
  ;EndIf

Until Event=#PB_EventCloseWindow
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by PB.

> i try to figure out which RichEditGadget is active.
> Is there a function who give me the right RichEditHadget ID/Handle ?

GetFocus_() = Handle of item with the focus (active).

So in your example, replace ?????=hnd_Rich0 with GetFocus_()=hnd_Rich0
and ?????=hnd_Rich1 with GetFocus_()=hnd_Rich1.


PB - Registered PureBasic Coder
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by WolfgangS.

Thank you PB !!!!

MFG
WolfgangS
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by El_Choni.

Hmmm, I should add that... Thanks, PB.

Bye,

El_Choni
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by PB.

No problem, guys. :)


PB - Registered PureBasic Coder
Post Reply