Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It seems to work with the example from Microsoft Connect:</p> <pre><code>uses ShlObj; //BFFM_INITIALIZED... OnCallBack := actBrowseProjectPathCallback; procedure TSettingsDialogBase.actBrowseProjectPathCallback( Sender: TBrowseForFolder; Wnd: HWND; uMsg: Cardinal; lParam, lpData: Integer; var Result: Integer); begin inherited; if uMsg = BFFM_INITIALIZED then begin SendMessage(Wnd, BFFM_SETSELECTION, 1, Integer(@Sender.Folder[1])); Sleep(1000); PostMessage(Wnd, BFFM_SETSELECTION, 1, Integer(@Sender.Folder[1])); end; end; </code></pre> <p>This gives focus on the selected folder - even if it not was in the visible region before, in the tree. My problems seems to be solved! If someone see a problem with this - please respond!</p> <p>Here's what the OP of that workaround had to say on:<br> <a href="http://connect.microsoft.com/VisualStudio/feedback/details/518103/bffm-setselection-does-not-work-with-shbrowseforfolder-on-windows-7#" rel="nofollow">http://connect.microsoft.com/VisualStudio/feedback/details/518103/bffm-setselection-does-not-work-with-shbrowseforfolder-on-windows-7#</a></p> <blockquote> <p>I was able to find a workaround. The problem seems to be that when the BFFM_INITIALIZED callback occurs and you send the BFFM_SETSELECTION message, the tree must be open and initialized BEFORE the BFFM_SETSELECTION message is sent. In other words, it looks like the bug is that the scroll-to code is being executed before the tree is fully open and it fails.</p> <p>If you send the BFFM_SETSELECTION message in the callback, the tree opens but the selection is not scrolled-to. To get it to scroll, you must send a SECOND identical BFFM_SETSELECTION message on a delay. THEN the tree scrolls to the selected folder. The first message in the BFFM_INITIALIZED callback still has to occur to open the tree, then a second delayed message must be sent and it will work. A couple of ways to do this. One is to set a flag when BFFM_INITIALIZED occurs and just continue sending the BFFM_SETSELECTION for <em>every</em> callback after that. Or you can set a timer in your code to fire the message a second time, say 500 to 1000 ms later.</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload