Author Topic: How does a widget know how to draw?  (Read 1138 times)

IngeniousMask

  • Traveller
  • *
  • Posts: 13
    • View Profile
How does a widget know how to draw?
« on: February 11, 2005, 07:50:00 am »
First off, I hope I am allowed to ask questions about the general code.  If not, sorry, and I will not do again.

Anyway, I was wondering when a widget knows how to display itself.  I know each widget has a draw() function, but I was wondering when it is called.  Does it get called when the widget is loaded by LoadWidget(), or is it drawn by another function call/event handling.  I have been examining the code and I have been unsucessful in answering my own question.  Any help would be great!

~IngeniousMask

IngeniousMask

  • Traveller
  • *
  • Posts: 13
    • View Profile
(No subject)
« Reply #1 on: February 11, 2005, 08:00:52 am »
Well, after more searching, I believe i found the answer in the event handling of csCmdProcess.  Any explanation is still wecome though.

Karosh_Steinkatz

  • Hydlaa Citizen
  • *
  • Posts: 486
    • View Profile
(No subject)
« Reply #2 on: February 11, 2005, 11:40:26 am »
Hmm, it has been a while, but I think to show and hide a widget you use widget->Show(); and widget->Hide(); if that\'s what you mean.


Back to Planeshift again \\o/

acraig

  • Administrator
  • Veteran
  • *
  • Posts: 1562
    • View Profile
(No subject)
« Reply #3 on: February 11, 2005, 03:44:35 pm »
A widget draws when it\'s parent draws.  There is one \'main\' widget which is the desktop which all other windows are children of.  On every frame mainwidget->Draw() is called.  He goes through all his children and if they are visible calls their Draw on it.  This in turn causes all the childs children to be drawn and so on down the chain.
----------
Andrew
"For all I know, she's lying, everyone's lying; welcome to the Internet"

IngeniousMask

  • Traveller
  • *
  • Posts: 13
    • View Profile
(No subject)
« Reply #4 on: February 12, 2005, 02:43:25 am »
Okay, thanks for the help.  Now I can continue working through the psclinet!