PlanetSquires Forums

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: ? about interacting with controls in code  (Read 342 times)

Anonymous

  • Guest
? about interacting with controls in code
« on: August 23, 2005, 05:20:23 PM »

I'm still pretty new to this tool and so far I have mainly done dll's without forms. Now I'm trying to add a form to a dll, and basically this goes fine but there is one thing that has got me stuck at the moment.

if I in a function use the code
Code: [Select]
FF_LISTBOX_SETCURSEL HWND_FRMATLASVIEW_LSTPLACES, 0&

the item get selected in the listbox BUT my code in the controls
Code: [Select]
FUNCTION FRMATLASVIEW_LSTPLACES_LBN_SELCHANGE
handler never fires, which it does if I select the item by clicking it instead.

Why and how can I "make it happen"? I have tried to use SendMessage as well but with same result, what am I missing?

/Joakim
Logged

TechSupport

  • Guest
? about interacting with controls in code
« Reply #1 on: August 23, 2005, 05:46:25 PM »

Internally, FireFly uses the LB_SETCURSEL message to change the selected ListBox item. According to the Win32 Help, a notification does not fire when this message is used:
Quote

This notification message is not sent if the LB_SETCURSEL message changes the selection.


You can simulate sending the notification by using the following after your FF_LISTBOX_SETCURSEL function call:

Code: [Select]

SendMessage HWND_FRMATLASVIEW_LSTPLACES, %WM_COMMAND,  maklng(IDC_FRMATLASVIEW_LSTPLACES, %LBN_SELCHANGE), HWND_FRMATLASVIEW_LSTPLACES
Logged

Anonymous

  • Guest
? about interacting with controls in code
« Reply #2 on: August 23, 2005, 07:57:33 PM »

Quote from: "TechSupport"
Internally, FireFly uses the LB_SETCURSEL message to change the selected ListBox item. According to the Win32 Help, a notification does not fire when this message is used:
Quote

This notification message is not sent if the LB_SETCURSEL message changes the selection.



Yes, I actually found out that after some reading in the Win32 Help, I'm just a bit  :? of all this Windows Messages stuff and what does what in FF...

Quote from: "TechSupport"
You can simulate sending the notification by using the following after your FF_LISTBOX_SETCURSEL function call:

Code: [Select]

SendMessage HWND_FRMATLASVIEW_LSTPLACES, %WM_COMMAND,  maklng(IDC_FRMATLASVIEW_LSTPLACES, %LBN_SELCHANGE), HWND_FRMATLASVIEW_LSTPLACES


Probably works, but I also found out I can trap the SETCURSEL message in the "catch all" CUSTOM handler of the control. It's a bit more effective I think as I can just put my function call there to act on the selection.

I understand there are a great deal of work on my behalf needed to read up on the Win32 Help, but it's a HUGE document. It would really be useful as well as helpful for beginners with some simple tutorial about the most obvious and simple things as you quickly get lost and confused trying to understand the Win32 Help. Things like, how to trap that user clicked in a TextBox etc. have trid to figure this out for at last an hour now, reading Win32 Help, without success but maybe I have just been reading to much for now.

Coming from VB6 you are just too spoiled with the IDE serving it all to you, and there is both pros and cons with that, but I belive I'm probably not the only one that starts to look for a replacement to VB6 now when it's left to fade away... PB in combination with FF is a damned good alternative, but it's a process that have to take some time... A good starter tutorial (FF for (VB) Dummies) could sure help in getting more VB programers to take this route instead of the .NET insanity.

/Joakim
Logged