Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Callback in a Class
#1
Hi Gintaras:

Is it possible to set a callback function inside a class?
mt.originalCtrlWndProc=+SetWindowLong(GetDlgItem(this.m_hWnd,mt.m_id), GWLP_WNDPROC, +(this.WndPrc));

thank you
Regards
#2
In QM, class member functions cannot be used for callback. Use normal function.
#3
Thank you Gintaras

I solved this using a normal function, however i will describe how i solved it maybe for future reference

in order to solve variable scope i have used a global class pointer like this:

Macro
Code:
Copy      Help
#compile "__SkinDlg"

type myClsTyp SkinDlg*gt
myClsTyp+ GlobalSkin

if(!ShowDialog("Dlg_SkinnableSample" &Dlg_SkinnableSample)) ret

inside the Dialog function i used the following

Function Dlg_SkinnableSample
Code:
Copy      Help
SkinDlg-- DlgClass
SkinCtrl-- MyCloseBtn1
SkinCtrl-- MyCloseBtn2
SkinCtrl-- MyCloseBtn3
GlobalSkin.gt=&DlgClass

Now any thread can get access to my class like this (using global type):

GlobalSkin.gt.[any member or method]

and the last step was the following

mt.originalCtrlWndProc=+SetWindowLong(GetDlgItem(this.m_hWnd,mt.m_id), GWLP_WNDPROC, &WndPrc);

The window procedure could be declared outside my class and that function can acces to any class member.

Thank you Gintaras i have seen some other posts at this forum to do this.

Regards


Forum Jump:


Users browsing this thread: 1 Guest(s)