April 25, 2024, 03:11:56 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


_GetDlgCtrlID(@Code)

Started by Egil, October 24, 2016, 10:02:22 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Egil

October 24, 2016, 10:02:22 AM Last Edit: October 24, 2016, 10:04:47 AM by Egil
When seeing Andy's renewal of his MouseOverControl, I came to think of an example in the old IB-Pro Code Archive.
The example (copied from file MouseOverControl.iba) shows that the mouseover effect it is very easy to implement using a Dialog. This simple code does the trick:
SUB d1_handler
   String text
   SELECT @MESSAGE
      Case WM_SETCURSOR
         Select _GetDlgCtrlID(@Code)
            Case BUTTON_1
               text = "Button 1"
            Case BUTTON_2
               text = "Button 2"
            Case STATIC_3
               text = "Static Text"
            Case CHECK_4
               text = "Check Box"
            Default
               text = ""
     ENDSELECT


Windows.inc must be included in the source file.

Does anyone know if there is an equivalent for  _GetDlgCtrlID(@Code) that can be used in a window?


Egil

PS. Forgot to mention that the variable "text" is written  to a statusbar...
Support Amateur Radio  -  Have a ham  for dinner!

Egil

The answer to above question appeared to be rather  simple. Should have searched the forum a little more before asking for help.

User pistol350 had posted some old code by bevets that uses GeltDlgCtrlID in a window, exacly  the same way as in the dialog example, but whithout the leadidng underscore:
http://www.ionicwind.com/forums/index.php?topic=2788.msg23432#msg23432


Egil
Support Amateur Radio  -  Have a ham  for dinner!

Andy

October 25, 2016, 05:22:34 AM #2 Last Edit: October 25, 2016, 05:39:30 AM by Andy
Egil,

That's some detective work.  8)

Just when you think you've invented the wheel, you find someone has already done it  :'(
however I must defend my little piece of code - MouseOverControls.inc

Okay I wrote it, so I find it easy to use, but I think most people will think the same too.

My commands go (and will go) a lot further as I develop it, for instance my include file detects if the mouse is actually over any control, or over any control type such as any button, as well as a specific control.

Should you choose to hide a control, my include file will still notify you when the mouse is over it.

It tells you what state the window is in i.e. minimised, maximised, normal.

Also you can detect if the mouse is over the window or not.

And as I go along, I always provide a help file and examples.  ;)

Still, and with all that said, the posted example by pistol350 is very good, and I don't want this reply to sound like sour grapes!  ::)

Andy.


Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Egil

Just relax Andy...

In this case your method is by far the easiest to use, and with more functionality.
But I was curious, and just had to check it out.

And for reinventing the wheel... I have done that numerous times. I'm sure you know the feeling. Finished your coding masterpiece and feeling good, only to find that someone had done the same ten years ago, and very often in a much better way.

So now, when I need a "new" function, I always  search the  forum before I start coding. Most of the time I  find what I need. My main problem is determining what to search for. Or what to ask for if I ask other forum members for help. Never been turned down yet, so to me the forum is really a goldmine!



Egil

Support Amateur Radio  -  Have a ham  for dinner!

Andy

October 25, 2016, 06:00:43 AM #4 Last Edit: October 25, 2016, 06:10:32 AM by Andy
Quote from: Egil on October 25, 2016, 05:55:55 AM
Just relax Andy...

My main problem is determining what to search for. Or what to ask for if I ask other forum members for help. Never been turned down yet, so to me the forum is really a goldmine!

Egil

Egil,

Don't worry I'm nice and relaxed about it!

And as for this forum and everyone on it, it really is a goldmine (and the members are too)!

Andy.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.