Announcement

Collapse
No announcement yet.

combobox execution

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

  • combobox execution

    I'm using Win 9.0 with XP SP2. I am a "nubi" who manages painfully to get programs working over too long a time. Now I'm stuck with this: I want to update textboxes after using a dialog to make changes to the data in the boxes.
    I would like to do this without mouse or keyboard. Is there any way to have the program emulate a click on the combobox? I am unselecting the combobox, doing the change dialog, and then selecting the combobox. Updating the text boxes doesn't work.
    The programs too large to post. Your pros say ask even if it's stupid, so I'm asking.

  • #2
    want to update textboxes after using a dialog to make changes to the data in the boxes.
    I would like to do this without mouse or keyboard. Is there any way to have the program emulate a click on the combobox? I am unselecting the combobox, doing the change dialog, and then selecting the combobox. Updating the text boxes doesn't work.

    I don't get the "click on the combobox" stuff, but SetDlgItemText() or SetWindowText() (SDK) or CONTROL SET TEXT (DDT) will update the text of either a label or edit ("textbox") control. If it "doesn't work" then you are doing something wrong but no one here can divine what that might be without seeing some code.

    If you want to change the currently selected item in a combobox control, you can use the CB_SETCURSEL message (SDK) or the COMBOBOX SELECT statement ( DDT).

    MCM
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      Thanks Michael-
      COMBOBOX SELECT hDlg, %IDC_combobox1, 1
      COMBOBOX UNSELECT hDlg, %IDC_combobox1 ' If I don't do this, it doesn't get updated.

      ShowDIALOG20 %HWND_DESKTOP 'This dialog does a payment for this record

      UpDateFile ' copies the data array to the data file


      COMBOBOX SELECT hDlg, %IDC_combobox1, gCurrentEntry ' selects this record

      UdtToDialog (hDlg, gCurrentEntry) 'should, but doesn't set new text

      SUB UdtToDialog(BYVAL hDlg AS DWORD, Index AS LONG)

      LOCAL Temp AS clFileType132
      LOCAL SaveState AS LONG
      LOCAL y AS LONG

      IF Index > UBOUND(gClArray(1)) OR Index < LBOUND(gClArray(1)) THEN
      RESET Temp
      ELSE
      Temp = gClArray(Index)
      END IF

      ' When we change the edit control data, we generate EN_UPDATE messages...
      ' Due to the design of our GUI interface, we would end up with the ADD and UPDATE
      ' buttons becoming enabled just because we loaded a new UDT record into the dialog.
      ' To overcome this, we set the "modified" flag to %TRUE, so the main callback
      ' function ingores the "update" notication messages.

      SaveState = gIsRecModified
      gIsRecModified = %TRUE



      'Client Page
      CONTROL SET TEXT hDlg, %IDC_TEXTBOX1 , RTRIM$(Temp.Clnumber)

      CONTROL SET TEXT hDlg, %IDC_TEXTBOX7 , RTRIM$(Temp.Business)
      CONTROL SET TEXT hDlg, %IDC_TEXTBOX9 , RTRIM$(Temp.ClType)
      CONTROL SET TEXT hDlg, %IDC_TEXTBOX10 , RTRIM$(Temp.First1)
      CONTROL SET TEXT hDlg, %IDC_TEXTBOX12 , RTRIM$(Temp.Last1)
      CONTROL SET TEXT hDlg, %IDC_TEXTBOX13 , RTRIM$(Temp.Street)
      CONTROL SET TEXT hDlg, %IDC_TEXTBOX14 , RTRIM$(Temp.City)
      CONTROL SET TEXT hDlg, %IDC_TEXTBOX16 , RTRIM$(Temp.State1)
      CONTROL SET TEXT hDlg, %IDC_TEXTBOX17 , RTRIM$(Temp.zip1)
      ''''''more
      end sub

      I think because I've got tabs in this something else is causing this. The udtToDialog appears to work in de-bug. I can create something similar in the little sample tab program and it works ok. I started with that because of the tabbing problem.
      If I click the combobox everything works OK. I would like not to have to do that.
      That's why I asked if there is a command to substitute for that mouse click.
      Hope this makes sense.
      Dick

      Comment


      • #4
        For sure you need to use the code tags ==>

        http://www.powerbasic.com/support/pb....php?do=bbcode

        You should never have to actually click or even send a fake click to get your controls to look the way they should. Besides, what if your user uses the KEYBOARD instead of the mouse to navigate?

        MCM
        Michael Mattias
        Tal Systems (retired)
        Port Washington WI USA
        [email protected]
        http://www.talsystems.com

        Comment


        • #5
          For sure you need to use the code tags ==>

          http://www.powerbasic.com/support/pb....php?do=bbcode
          Agreed, and thank you for posting that link (I have long since lost my link and can not remember all the commands that I do not use often.

          You should never have to actually click or even send a fake click to get your controls to look the way they should.
          Actually one would if you want your callback to show the current state (depending on a control, setting a combobox index, will not send the click to update other controls.
          But then again, when matching display to current content (especially if accessed from outside the dialog/form/window) then its time to build a function that any can call and show the proper display

          Besides, what if your user uses the KEYBOARD instead of the mouse to navigate?
          case in point for above...display to match value, but not knowing if a "Click" was a click of the keyboard??? or the mouse????

          Time for that function I should have made to be called from both

          (When will I learn to take my own advice as well as I can give it???? (only Mr. Owl Knows) )
          Engineer's Motto: If it aint broke take it apart and fix it

          "If at 1st you don't succeed... call it version 1.0"

          "Half of Programming is coding"....."The other 90% is DEBUGGING"

          "Document my code????" .... "WHYYY??? do you think they call it CODE? "

          Comment


          • #6
            Originally posted by Dick Bottom View Post
            'Client Page
            CONTROL SET TEXT hDlg, %IDC_TEXTBOX1 , RTRIM$(Temp.Clnumber)
            What you might try is:
            Code:
            Control [B]Redraw[/B] hdlg, %IDC_TEXTBOX1 
            ...
            Control [B]Redraw[/B] hdlg, %IDC_TEXTBOX7 
            ...
            Control [B]Redraw[/B] hdlg, %IDC_TEXTBOX9
            After each Set Text. Worst can happen is it doesn't work.

            ======================================================
            Liberty, equality - bad principles!
            The only true principle for humanity is justice;
            and justice to the feeble is protection and kindness.
            Henri-Frédéric Amiel
            ======================================================
            It's a pretty day. I hope you enjoy it.

            Gösta

            JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking
            LDN - A Miracle Drug: http://www.SwedesDock.com/LDN/

            Comment


            • #7
              >but not knowing if a "Click" was a click of the keyboard??? or the mouse????

              It should not make a difference. The user expects to 'click' a button EITHER by using the mouse or by pressing <spacebar> when the button has the keyboard focus... which is why WM_COMMAND/BN_CLICKED is generated in either case.

              PS: The link to the code tags is on the lower-left-hand corner of each 'posting' page, the "VbCode is ON" link. Using IE you just Right-click, copy shortcut.
              Michael Mattias
              Tal Systems (retired)
              Port Washington WI USA
              [email protected]
              http://www.talsystems.com

              Comment


              • #8
                Thanks for pointing out the code tags. I didn't have a clue.
                I'll spend some time experimenting to find the problem.

                Comment


                • #9
                  PS: The link to the code tags is on the lower-left-hand corner of each 'posting' page, the "VbCode is ON" link. Using IE you just Right-click, copy shortcut.
                  Another nice one...since I KNEW it existed, but lost the link. ANNNND no clue where to find it.

                  I took your clue for "VbCode Is On" (odd choice of words cause I would think VB as in "Visual Basic" and not "links are on" (or maybe they mean the same??? who knows???)

                  Anyways finding the link and a copy paste in mozilla
                  VbCode is on
                  and
                  http://www.powerbasic.com/support/pbforums/misc.php?do=bbcode"]VbCode is on
                  work in Mozilla Firefox 3.0.6 as well

                  Engineer's Motto: If it aint broke take it apart and fix it

                  "If at 1st you don't succeed... call it version 1.0"

                  "Half of Programming is coding"....."The other 90% is DEBUGGING"

                  "Document my code????" .... "WHYYY??? do you think they call it CODE? "

                  Comment

                  Working...
                  X