PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0
Showing posts with label controls. Show all posts
Showing posts with label controls. Show all posts

Tuesday, July 12, 2022

[FIXED] what is ComboBox message 359 0x167?

 July 12, 2022     combobox, controls, message, winapi     No comments   

Issue

I cannot find this info anywhere, including in the official Windows API documentation. It is sent to the subclassing procedure when the control loses focus. It is not defined in winuser.h.

It is sent like this:

0x02D - WM_DELETEITEM
0x167 - ???
0x202 - WM_LBUTTONUP

My compiler is MinGW, system Windows XP SP3.


Solution

0x167 is in the range of messages that is reserved for system use. Messages in this range that are not explicitly defined in the SDK are private for the system's internal use. This is stated as much in the documentation:

#define WM_USER 0x0400

.

0 through WM_USER –1

Messages reserved for use by the system.

Message numbers in the first range (0 through WM_USER –1) are defined by the system. Values in this range that are not explicitly defined are reserved by the system.



Answered By - Remy Lebeau
Answer Checked By - Timothy Miller (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to send a CBN_SELCHANGE message when using CB_SETCURSEL?

 July 12, 2022     c++, combobox, controls, message, winapi     No comments   

Issue

When using the CB_SETCURSEL message, the CBN_SELCHANGE message is not sent.

How to notify a control that the selection was changed ?

P.S.

I found on the Sexchange site, a very ugly hack :

SendMessage( hwnd, 0x014F/*CB_SHOWDROPDOWN*/, 1, 0 );
SendMessage( hwnd, 0x014E/*CB_SETCURSEL*/, ItemIndex, 0 );
SendMessage( hwnd, 0x0201/*WM_LBUTTONDOWN*/, 0, -1 );
SendMessage( hwnd, 0x0202/*WM_LBUTTONUP*/, 0, -1 );

Will do for now... Not really.

P.S.2

For resolving my problem, I'll follow Ken's suggestion in the comments.


Solution

You're not supposed to use CBN_SELCHANGE unless the change in selection was made by the user.

You don't indicate what language you're using; it would make it easier to provide you with a workaround if you did so.

In Delphi, where an OnChange() would be associated with the combobox, you just call the event method directly:

// Send the CB_SETCURSEL message to the combobox
PostMessage(ComboBox1.Handle, CB_SETCURSEL, Whatever, WhateverElse);

// Directly call the OnChange() handler, which is the equivalent to CBN_SELCHANGE
ComboBox1Change(nil);


Answered By - Ken White
Answer Checked By - Cary Denson (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Wednesday, May 18, 2022

[FIXED] How to incrementally load an asp.net page having a Repeater control?

 May 18, 2022     asp.net, controls, partial, rendering, repeater     No comments   

Issue

I have a page that shows results of a query. The results are displayed using a Repeater control that emits a div element that holds text data and images related to that particular result. The problem is that the page takes considerable amount of time to load partly because of the huge amount of processing required to generate the data.

So, is there a way to improve the page load by incrementally rendering the page rather than the have the user wait until the full data is available

I was thinking about sending the text data of each result first, and then as the images are available, send them to client to be displayed with each result. I guess I will need to use AJAX, but I'm not exactly sure how to get this done.

Does anyone have any suggestions or experience with this situation?

Thanks,


Solution

If you are going to control the flow, you can set up flushing on the binding event so the data is flushed out prior to having everything. But that may not be the best option; and, with standard tagged documents (rather than CSS docs) it might not help anyway, as the browser may not render even when flushed (depends on the tags in the Repeater).

Another option is retrieving via AJAX and flusing as data comes in (or at least showing a "wait for it" graphic). The wait graphic can be done without AJAX, but the load with AJAX pattern is well documented.

You can also limit the amount of data on a single page, unless this is a report of some type.



Answered By - Gregory A Beamer
Answer Checked By - David Goodson (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Sunday, January 16, 2022

[FIXED] CakePHP 3 Unable to emit headers when using associated data in control form

 January 16, 2022     cakephp, controls, forms     No comments   

Issue

I'm using CakePHP 3.6.7 and my problem is that when I use associated data in control form I got the unable to emit headers warning.

Here's my code:

AppController.php initialize function (If the user is logged in, i retrieve all his data from here)

public function initialize() {

parent::initialize();

// Retrieve user data for all views
if($this->request->getSession()->read('Auth.User')) {
    $this->user = $this->Users->get($this->request->getSession()->read('Auth.User.id'), [
        'contain' => ['UserPersonalData']
    ]); 
    $this->set('user', $this->user);
    $this->set('_serialize', 'user');
}

}

UserPersonalDataController.php initialize function

public function initialize()
{
    parent::initialize();

}

UserPersonalDataController.php edit function

public function edit()
{
    if ($this->request->is(['patch', 'post', 'put'])) {
        $userPersonalData = $this->Users->patchEntity($this->user, $this->request->getData());
        if ($this->Users->save($userPersonalData)) {
            $this->Flash->success(__('The user personal data has been saved.'));

            return $this->redirect($this->user->username);
        }
        $this->Flash->error(__('The user personal data could not be saved. Please, try again.'));
    }
}

edit.ctp, the following form will throw the unable to emit headers warning in debug mode

<div class="container" style="padding: 2rem">
<div class="users form large-9 medium-8 columns content">
    <?= $this->Form->create($user, [
        'class' => 'form-signin',
    ]); ?>
    <fieldset>
        <legend><?= __('Edit User') ?></legend>
        <?php
            echo $this->Form->control('user_personal_data.firstName', ['required' => true, 'class' => 'form-control', 'placeholder' => 'First Name', 'label' => false]);
            echo $this->Form->control('user_personal_data.lastName', ['required' => true, 'class' => 'form-control', 'placeholder' => 'Last Name', 'label' => false]);
            echo $this->Form->control('user_personal_data.phone', ['required' => true, 'class' => 'form-control', 'placeholder' => 'Phone', 'label' => false]);
        ?>
    </fieldset>
    <?= $this->Form->button(__('Submit'), ['class' => 'btn btn-lg btn-primary btn-block' ]) ?>
    <?= $this->Form->end() ?>
</div>

edit.ctp, the following form will not throw any warnings

<div class="container" style="padding: 2rem">
<div class="users form large-9 medium-8 columns content">
    <?= $this->Form->create($user, [
        'class' => 'form-signin',
    ]); ?>
    <fieldset>
        <legend><?= __('Edit User') ?></legend>
        <?php
            echo $this->Form->control('email', ['required' => true, 'class' => 'form-control', 'placeholder' => 'First Name', 'label' => false]);
        ?>
    </fieldset>
    <?= $this->Form->button(__('Submit'), ['class' => 'btn btn-lg btn-primary btn-block' ]) ?>
    <?= $this->Form->end() ?>
</div>

As I said, if I use associated data in control() form helper, it will throw that warning in debug mode. If I'm not in debug mode it will work just fine but I'm worried about it. Thanks for the help!

EDIT: Here's a screenshot of the warning: enter image description here


Solution

The problem is that, as Greg Schmidt said, I had a non well formated numeric value. Solved!



Answered By - Kigris
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Older Posts Home
View mobile version

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
All Comments
Atom
All Comments

Copyright © PHPFixing