Delphi For PHP Forums    


Go Back   Delphi-PHP Forums > Delphi For PHP > VCL4PHP
Forum Jump Register FAQ Members List Downloads Search Today's Posts Mark Forums Read

VCL4PHP VCL for PHP. Questions or comments about the Visual Component Library for PHP, post them here!

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 23rd July 2009, 07:58
D4PHP User
 
Join Date: Apr 2009
Posts: 51
kaku137 is on a distinguished road
Default ComboBox on a Window

I want to always display a default value of ComboBox1 on a Window1.

How should I do?

my code:
PHP Code:
function Label1JSClick($sender, $params)
{      
?>
//Add your javascript code here
   Window1.open();    
<?php
}
PHP Code:
function ComboBox1BeforeShow($sender$params)
{
    
$this->ComboBox1->Clear();
    
$this->ComboBox1->ItemIndex =2;
    
$ds $this->Datasource1->DataSet;
    
$ds->first();
    
// iterate through all records and add them
    
while (!$ds->EOF)
    {
        
// for example use $ds->LAST_NAME to access the fields value
        
$this->ComboBox1->AddItem($ds->aaa null $ds->bbb);
        
$ds->next();
     }

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 23rd July 2009, 10:09
D4PHP User
 
Join Date: Dec 2008
Posts: 46
Holgerwa is on a distinguished road
Default

You want to display the Item with Index 2 when the Combobox is shown?

After ComboBox1->Clear(), there are no items in the Combobox. Assigning ItemIndex = 2 is not possible at this time, because there is no Item with Index 2 to select.
Do ItemIndex = 2 after your loop, when the Combobox is populated.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT +1. The time now is 04:55.




Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0 ©2009, Crawlability, Inc.
Copyright © 2004 - 2009, G&J Solutions Ltd. All Rights Reserved. terms of use