Announcement

Collapse
No announcement yet.

Problem with New Development, Maybe?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Fred Buffington
    replied
    Great Job Brent !!

    That fixes the WM_LBUTTONDOWN and RBUTTONDOWN.

    every time i access the graphic putting new graphics on the next page,
    i simply
    CONTROL DISABLE hDlgPreview,%IDC_GRAPHIC1
    and it works as before.

    Leave a comment:


  • BRENT GARDNER
    replied
    Figured out how to use CONTROL ADD GRAPHIC, so it works like
    before update 8.04, atleast for my program. Here is what I discovered:

    Control Add Graphic: For single keypress hot key to work, add
    %SS_NOTIFY style to the CONTROL ADD GRAPHIC, then before adding "&Stop" button, Add "CONTROL DISABLE hDlg43, %D_FRAM",
    which is the graphic control.
    Code:
          CONTROL ADD GRAPHIC, hDlg43, %ID_FRAM, "",       0,  0,  660,700, %SS_NOTIFY
          GRAPHIC ATTACH hDlg43, %ID_FRAM
          GRAPHIC RENDER "PICT\BaloonBorder2.bmp",        (0,  0)-(660,700)
          CONTROL ADD TEXTBOX, hDlg43, %IDS_TEXT, "",     45, 45,  570,625, _
           %ES_MULTILINE OR %ES_READONLY OR %ES_AUTOHSCROLL OR %ES_WANTRETURN, %WS_EX_CLIENTEDGE
          CONTROL DISABLE hDlg43, %ID_FRAM
          CONTROL ADD BUTTON, hDlg43, %IDS_BUT, "&Stop", 300,679,   80, 20
    Code for Alt+S, or left mouse click on button and NO Single keypress hot key, works this way: (There is no %SS_NOTIFY ON graphic control and no "CONTROL DISABLE hDlg43, %ID_FRAM")
    Code:
          CONTROL ADD GRAPHIC, hDlg43, %ID_FRAM, "",       0,  0,  660,700
          GRAPHIC ATTACH hDlg43, %ID_FRAM
          GRAPHIC RENDER "PICT\BaloonBorder2.bmp",        (0,  0)-(660,700)
          CONTROL ADD TEXTBOX, hDlg43, %IDS_TEXT, "",     45, 45,  570,625, _
           %ES_MULTILINE OR %ES_READONLY OR %ES_AUTOHSCROLL OR %ES_WANTRETURN, %WS_EX_CLIENTEDGE
          CONTROL ADD BUTTON, hDlg43, %IDS_BUT, "&Stop", 300,679,   80, 20

    Leave a comment:


  • Fred Buffington
    replied
    Thanks John, that fixes the click. Now works for clicking on graphic
    Code:
           CASE %IDC_GRAPHIC1
               IF CBCTLMSG=%STN_CLICKED THEN
                 SendMessage hDlgPreview,%WM_COMMAND,304&,0
              END IF
    Now, just one more thing. The mouse Right button still is not acknowledged.
    Before i use it to 'unzoom' if the dialog was in 'zoom' mode.

    Actually it works (rbuttondown) as long as i am NOT over the graphic. Just found that.

    I added "IF ZOOM&=0" to the send message above then added
    IF CBCTLMSG=%STN_DBLCLK THEN
    IF ZOOM&=1 THEN SendMessage hDlgPreview,%WM_COMMAND,304&,0
    END IF
    END IF

    so now click to zoom, double click to 'unzoom'.

    Thanks to everyone. you guys are the greatest.
    Last edited by Fred Buffington; 12 Oct 2007, 10:35 PM.

    Leave a comment:


  • John Tate
    replied
    I am using winXP home and PB win 8.04. I can use %SS_CLICKED OR %SS_DBLCLK and using %SS_NOTIFY with my graphic and have the graphic respond by clicking anywhere on the graphic.

    CASE %idc_graphic1
    IF CBCTLMSG = %STN_CLICKED THEN
    'MSGBOX "you clicked the graphic"
    'DIALOG END CBHNDL, 0
    END IF

    I have a cancel button on my dialog which does not work if within the graphic with %SS_NOTIFY. Remove the %SS_NOTIFY and the cancel button works, but the graphic does not respond to a click.

    From what I see here, I could have a small graphic showing an exit sign, for example, and would not have to have a cancel button, using the code above.

    PB 8.04 seems to work as advertised here.

    John Tate

    Leave a comment:


  • BRENT GARDNER
    replied
    This update is really discouraging. The Loadbitmap code I posted above, works just like the Control Graphic used to work. In Windows XP and Windows Vista. I am in the middle of redesigning my programs and this update comes along, and Vista, or I think Long Horn was a better name(path is a mile long to get to folder).
    Can't understand how LoadBitmap can work like Graphic Control used to work. I guess once this
    has been updated, they can't go back?
    Last edited by BRENT GARDNER; 13 Oct 2007, 09:25 AM.

    Leave a comment:


  • Fred Buffington
    replied
    Actually, Brent, the buttons are at the top of the dialog du 2-16 (2-14 for imgbuttons)
    the graphic starts at dunit 20 so they aren't within the graphic area per se.
    And the buttons work fine. I was simulating a button press (304) when the
    left or right mouse button was pressed within the graphic. All worked fine until the update.

    I have a copy of 8.01 on another computer and i can recompile it with that to make it work,
    but would love to have 8.04 working.
    Last edited by Fred Buffington; 12 Oct 2007, 07:38 PM.

    Leave a comment:


  • BRENT GARDNER
    replied
    Fred,

    Just took a quick look at your lastest post and it looks like the button is
    on or in the same area as your graphic control? If this is true, from my
    testing, button will not execute. It has to be outside of Graphic Control.
    This ofcourse is for ver 8.04 only.

    Leave a comment:


  • Fred Buffington
    replied
    Here is a portion of my code
    Code:
         DIALOG NEW %HWND_DESKTOP, "Report Preview ", , , GPHW&+10, GPHH&+40,_ '293, 340, _
           %WS_MINIMIZEBOX OR %WS_SYSMENU TO hDlgPreview
    'msgbox str$(ghHandle)
         SendMessage hDlgPreview, %WM_SETICON, %ICON_SMALL, LoadIcon(ghHandle, "PROGRAM") ''"BUFF") ''PROGRAM")
         CONTROL ADD GRAPHIC, hDlgPreview, %IDC_GRAPHIC1, "", 3, 20, GPHW&,GPHH&,%SS_NOTIFY
    '%SS_NOTIFY doesnt seem to make a difference even added stn_clicked in callback but may have handled that incorrectly.
         CONTROL ADD IMGBUTTONX, hDlgPreview,301,"P1",     2,2,50,14 '30,16 'Print
         CONTROL ADD  BUTTON,hDlgPreview,302,"Next Page",054,2,45,16 '047,2,45,16
         CONTROL ADD BUTTON, hDlgPreview,303,"Prev Page",101,2,45,16 '097,2,45,16
         CONTROL ADD BUTTON, hDlgPreview,304,"Zoom in",  148,2,45,16 '147,2,45,16
         CONTROL ADD BUTTON, hDlgPreview,305,"Page Down",195,2,45,16
         CONTROL ADD IMGBUTTONX, hDlgPreview,306,"C1",   242,2,50,14 '30,16 'cancel
         CONTROL DISABLE hDlgPreview,303
         CONTROL DISABLE hDlgPreview,305
    
         DIALOG SHOW MODAL hDlgPreview CALL DlgProc1
    here is a portion of dlgproc
    Code:
      SELECT CASE CBMSG
        CASE %WM_INITDIALOG
           hCurZoom  = LoadCursor(GetModuleHandle(modulename), Cursorname) '"ZOOM")
          hPreview = GetDlgItem(hDlgPreview, %IDC_Graphic1) 'PREVIEW)
          hCursor1 = GetClassLong(hPreview, %GCL_HCURSOR)
          SetClassLong hPreview, %GCL_HCURSOR, hCurZoom 'Cursor2
          PageBeingViewed&=1
          PagesPreviewed&=1
          lResult&=previewit(coid$,pagesPreviewed&)
    
        CASE %WM_MOUSEMOVE  ' Ensure zoom cursor is used
           IF GetCursor <> hCurZoom THEN SetCursor hCurZoom
        CASE %WM_DESTROY
          DestroyCursor hCursor1
          DestroyCursor hCurZoom
        CASE %STN_CLICKED
          SendMessage hDlgPreview,%WM_COMMAND,304&,0
        CASE %WM_LBUTTONDOWN 'no longer works after update
              SendMessage hDlgPreview,%WM_COMMAND,304&,0
        CASE %WM_RBUTTONDOWN 'no longer works after update
            IF zoom&=1 THEN
              SendMessage hDlgPreview,%WM_COMMAND,304&,0
            END IF
        CASE %WM_COMMAND
    'inserted to at least make double click work
      IF CBCTLMSG=1 THEN 
        SendMessage hDlgPreview,%WM_COMMAND,304&,0
      END IF

    Leave a comment:


  • BRENT GARDNER
    replied
    Fred,

    Not with a CONTROL GRAPHIC. Just revised one of my sub routines
    with callback to get it to work like before with CONTROL ADD GRAPHIC. Have to use API calls. See example of code you may be able to use:
    Code:
    LOCAL PicTMap AS LONG 
          DIALOG NEW PIXELS, 0, "", , , 660,700, _
                      %WS_OVERLAPPEDWINDOW OR %WS_CLIPCHILDREN, %WS_EX_TOPMOST TO hDlg46
     IF ERR OR hDlg46 = 0 THEN EXIT SUB  ' Error occurred
     CONTROL ADD LABEL, hDlg46, %IDS_BUT, "", 0, 0, 660, 700,  %SS_BITMAP                                                        
     PicTMap = LoadImage(%Null,"PICT\GoldFrame1.bmp"  , %IMAGE_BITMAP,0,0, %LR_LOADFROMFILE)
     CONTROL SEND hDlg46, %IDS_BUT, %STM_SETIMAGE, %IMAGE_BITMAP, PicTMap
     CONTROL ADD TEXTBOX, hDlg46, %IDS_TEXT, "",      37,35,585,628, _  '45,45,570,622, _
         %WS_CHILD OR %WS_VISIBLE OR %ES_MULTILINE OR %ES_AUTOVSCROLL _
         OR %ES_READONLY OR %ES_WANTRETURN, %WS_EX_CLIENTEDGE ' These styles allow mousewheel
     CONTROL ADD BUTTON, hDlg46, 1, "&Stop", 300,665,80,20
    
    IN CALLBACK:
    LOCAL fBmp AS DWORD  
    CASE %WM_INITDIALOG  
            pBmp = LoadImage(%Null, "PICT\GoldFrame1.bmp", %IMAGE_BITMAP,0,0, %LR_LOADFROMFILE)
            CONTROL SEND CBHNDL, %IDS_BUT, %STM_SETIMAGE, %IMAGE_BITMAP, pBmp

    Leave a comment:


  • Fred Buffington
    replied
    I got double click to work by putting
    Code:
    IF CBCTLMSG=1 THEN
      SendMessage hDlgPreview,%WM_COMMAND,304&,0 
    END IF
    after
    CASE %WM_COMMAND
    and before SELECT CASE CBCTL

    304 is a button which does zoom in/out


    but still doesnt get the single click to work

    If i try using IF CBCTLMSG=%BN_CLICKED the program bombs.

    Actually the code ...CBCTLMSG=1... works with or without %SS_NOTIFY in the
    control add graphic statement

    So, does someone have an example that works with a single click on a graphic ?
    Last edited by Fred Buffington; 12 Oct 2007, 01:13 AM.

    Leave a comment:


  • Fred Buffington
    replied
    Im still having problems after the 8.04 update with mouse clicks.
    Now the buttons work fine as before but I have a graphic (to which I added
    %SS_NOTIFY) after reading the posts here.

    Before, (without ss_notify) wm_lbuttondown and wm_rbuttondown in the callback worked fine. Now neither works and i tried using a case
    %STN_CLICKED in the callback and that doesnt work either. I tried wm_L/R/buttonup too.

    anyone ?
    Last edited by Fred Buffington; 12 Oct 2007, 12:04 AM.

    Leave a comment:


  • Dale Yarker
    replied
    IMGBUTTONX instead of stacked image and button controls?

    Leave a comment:


  • BRENT GARDNER
    replied
    Simon,

    Have already tested button below graphic control and will work, but that doesn't solve my 4 programs worth of buttons on graphics. I can't just
    change all code. It would not look good either. I had a line control on
    opening page of program that required user to click in a specific area
    to open program. Now that won't work either. I ....in trouble...
    Just wished I would have known that a button on a graphic control is not supposed to execute. Can't see why this change had to be made
    anyway. Looks like it is limiting my program capilities enormously!!

    Leave a comment:


  • Simon Morgan
    replied
    Well, having 'active' controls overlapping is non-standard, so expect non-standard behavior! If two controls that both react to mouse clicks overlap, I guess it is undefined which one gets the message if you click in the area common to both (or which one's ID is passed to the dialog callback).

    But that doesn't explain why your DIALOG END procedure is being called when you click within the graphic control but outside the area of the Cancel button, since you are specifically testing for that button's ID in your callback.

    I suggest you move the Cancel button temporarily away from the graphic control for testing puposes, to eliminate problems caused by the overlap. Any remaining problems are then down to more straightforward coding errors.

    Leave a comment:


  • BRENT GARDNER
    replied
    OK Guys here's the problem.

    Through out my program, I have buttons on top of a Graphic Control.
    Usually just to show user how to close, instead of clicking the "x" in upper right hand corner. I checked duplicate id's, not so. After further
    testing, If button is added before Graphic control(and no notify), then of
    course it is covered by Graphic control, but if I click in area where it is,
    it shows up and closes. If button is added after Graphic control, it shows on screen, but when you left mouse click on it, nothing happens. So, with this version 8.04, you have to add %SS_NOTIFY to graphic
    control to get button to execute. It will not execute if it is on top of Graphic control unless Graphic control has %SS_NOTIFY style. Then in CALLBACK FUNCTION, you have to do a Dialog end cbhndl FOR THE GRAPHIC
    CONTROL - or button does nothing.
    Last edited by BRENT GARDNER; 11 Oct 2007, 12:50 PM.

    Leave a comment:


  • Kev Peel
    replied
    My guess, as Simon's, is that a duplicate control ID is being used, or the ID is not checked in response to WM_COMMAND, in this code shown it is, so it's more than likely a duplicate ID.
    Last edited by Kev Peel; 11 Oct 2007, 10:24 AM.

    Leave a comment:


  • Simon Morgan
    replied
    Have you used a constant of the same value for 2 different controls? You seem to use both %IDC_CAN and %IDCANCEL to identify your button in different parts of the code!

    Otherwise I can't see how adding %SS_NOTIFY to CONTROL ADD GRAPHIC can affect your cancel button (you should only need this style to pick up clicks on the graphic control itself - clicks on buttons notify the callback by default).

    Leave a comment:


  • BRENT GARDNER
    replied
    Now, problem is user can click anywhere on Graphic control to close.
    They don't have to click on button to close? But without %SS_NOTIFY Style on Graphic control, mouse left click on button will not execute.?
    What a mess! This affects entire 4 programs I'am working on.

    Leave a comment:


  • Tom Cone Jr
    replied
    Even though this is probably obvious to most, it would be helpful for beginners if a snippet showing the code correction(s) was posted. Thanks.

    Leave a comment:


  • Simon Morgan
    replied
    From the PB/Win 8.03 help file:
    A graphic control will only send notification messages to a callback if the %SS_NOTIFY style is used.
    If you make use of undocumented behaviour, it's your problem if this changes at the next update!

    Leave a comment:

Working...
X