September 26, 2022, 06:07:56 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Having problem with getcontrol() function :-\

Started by pistol350, June 14, 2007, 01:12:57 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

pistol350

sub onSourceBrowse()
{
   DSTRING path[260] ;
   path = FileRequest("Browse for wma file", d1, TRUE, "wma Files|*.wma||", "wma") ;
   if (path[0])
   {
      CButton *pButton = GetControl(EDIT_FILEIN);
      pButton->SetText(path) ;
      SetDefaultDestination() ;
   }
   return ;
}


What's wrong in this code ?
There is first a problem with the FileRequest() function. I don't know how to use it correctly with my dialog "d1)

Then, when i compile my code , i got an invalid argument to if statement error.
i tried "if (path[0] = true) but it doesn't work either.

And finally, the most important error is with the getcontrol() function.
I got an "undeclared function GetControl" error to each line with GetControl.Even with this :
CButton *pButton = GetControl(EDIT_FILEIN);
pButton->SetText(path) ;

I, then wonder if the declaration error is not caused by the use of the getcontrol() function (in a subroutine as above) other than in the implementation of Oncontrol() for instance.

Well, all this is very new to me , so i apologize for not saying things correctly  :D

Regards,

Peter B.

John S

Try this


sub onSourceBrowse()
{
   DSTRING path[260] ;
   path = FileRequest("Browse for wma file", this, TRUE, "wma Files|*.wma||", "wma") ;  // this
   if ( len(path) )
   {
      CButton *pButton;
      pButton = GetControl(EDIT_FILEIN);
      pButton->SetText(path);
      SetDefaultDestination();
   }
   return ;
}
John Siino, Advanced Engineering Services and Software