1. EditBoxes?

Hey Guys,

I was wondering if editboxes could hold more than just text, like images and such. Last time I checked, edit-boxes could only hold text, however I know editboxes should be able to hold more than just text. I am using the newest version of win32lib and am wondering if the editboxes can now hold more than just text, like images.

new topic     » topic index » view message » categorize

2. Re: EditBoxes?

Andy said...

Hey Guys,

I was wondering if editboxes could hold more than just text, like images and such. Last time I checked, edit-boxes could only hold text, however I know editboxes should be able to hold more than just text. I am using the newest version of win32lib and am wondering if the editboxes can now hold more than just text, like images.

Andy:
You would have to use OWNERDRAW editboxes.

new topic     » goto parent     » topic index » view message » categorize

3. Re: EditBoxes?

Andy said...

Hey Guys,

I was wondering if editboxes could hold more than just text, like images and such. Last time I checked, edit-boxes could only hold text, however I know editboxes should be able to hold more than just text. I am using the newest version of win32lib and am wondering if the editboxes can now hold more than just text, like images.

Why do you want images inside and editbox? The editbox is for editing text. That is its purpose. What is the point of putting images inside that?

Can you tell us a bit more about what you want the users of your progam to be able to do and we might be able to give you some more clues.

new topic     » goto parent     » topic index » view message » categorize

4. Re: EditBoxes?

You could create a "box" with a sunken border and in that, place an image and edit control (with no borders). I could whip up a quick demo if you want...

-Greg

new topic     » goto parent     » topic index » view message » categorize

5. Re: EditBoxes?

Andy said...

Hey Guys,

I was wondering if editboxes could hold more than just text, like images and such. Last time I checked, edit-boxes could only hold text, however I know editboxes should be able to hold more than just text. I am using the newest version of win32lib and am wondering if the editboxes can now hold more than just text, like images.

Sounds like you're looking for a Rich Text Control.

wxEuphoria has a wxRichTextCtrl.

I believe that Win32Lib has a similar capability as well. I thought that there was a demo showcasing this, but I'm not certain. The archive does have a demo for inserting images into a rich edit control using Win32Lib.

Matt

new topic     » goto parent     » topic index » view message » categorize

6. Re: EditBoxes?

bernie said...
Andy said...

Hey Guys,

I was wondering if editboxes could hold more than just text, like images and such. Last time I checked, edit-boxes could only hold text, however I know editboxes should be able to hold more than just text. I am using the newest version of win32lib and am wondering if the editboxes can now hold more than just text, like images.

Andy:
You would have to use OWNERDRAW editboxes.

Thanks for the help guys, but I have not heard of OwnerDraw editboxes. Is there some special function for them, are they part of win32lib, how do you use them?

new topic     » goto parent     » topic index » view message » categorize

7. Re: EditBoxes?

Here's a demo of what I mentioned earlier. Notice how I create a child Window, Icon, and EditText. Then I made a quick routine to apply the correct styling and another to handle the resize event.

http://ghaberek.googlepages.com/editbox.png

 
include Win32Lib.ew 
without warning 
 
integer r_Box_onResize 
 
procedure makeEditBox( integer box, integer image, integer edit, object icon ) 
    setUserProperty( box, "Image", image ) 
    setUserProperty( box, "Edit",  edit  ) 
    addStyle( box, {WS_BORDER,WS_EX_CLIENTEDGE} ) 
    removeStyle( edit, {WS_BORDER,WS_EX_CLIENTEDGE} ) 
    setWindowBackColor( image, getSysColor(COLOR_WINDOW) ) 
    setIcon( image, icon ) 
    setHandler( box, w32HResize, r_Box_onResize ) 
end procedure 
 
procedure Box_onResize( integer pSelf, integer pEvent, sequence pParams ) 
 
    object image, edit 
    sequence rect 
     
    image = getUserProperty( pSelf, "Image" ) 
    edit  = getUserProperty( pSelf, "Edit"  ) 
     
    rect = getClientRect( pSelf ) 
    setRect( image[1], 0, 0, 16, rect[4], w32True ) 
    setRect( edit[1], 16, 0, rect[3]-16, rect[4], w32True ) 
 
end procedure 
r_Box_onResize = routine_id("Box_onResize") 
 
constant  
    Main        = create( Window, "EditText w/image", 0, Default, Default, 480, 70, 0 ), 
    Box         = create( Window, "", Main, 0, 0, 0, 0, {WS_CHILD+WS_VISIBLE} ), -- mind your styles here 
    Image       = create( Icon, "", Box, 0, 0, 0, 0, 0 ), 
    Edit        = create( EditText, "", Box, 0, 0, 0, 0, 0 ), 
    Btn         = create( Button, "Click", Main, 0, 0, 0, 0, 0 ) 
     
    makeEditBox( Box, Image, Edit, extractIcon({"pilcrow.ico", 1}) ) 
 
procedure Main_onResize( integer pSelf, integer pEvent, sequence pParams ) 
 
    setRect( Box, 10, 9, {w32Edge,-100}, 22, w32True ) 
    setRect( Btn, {w32AltEdge,-90}, 8, 80, 24, w32True ) 
 
end procedure 
setHandler( Main, w32HResize, routine_id("Main_onResize") ) 
 
procedure Btn_onClick( integer pSelf, integer pEvent, sequence pParams ) 
 
    VOID = message_box( '"' & getText(Edit) & '"', "Text", MB_ICONINFORMATION ) 
 
end procedure 
setHandler( Btn, w32HClick, routine_id("Btn_onClick") ) 
 
WinMain( Main, Normal ) 

Here's the icon I used in the demo: pilcrow.ico

-Greg

new topic     » goto parent     » topic index » view message » categorize

8. Re: EditBoxes?

ghaberek said...

Here's a demo of what I mentioned earlier. Notice how I create a child Window, Icon, and EditText. Then I made a quick routine to apply the correct styling and another to handle the resize event.

http://ghaberek.googlepages.com/editbox.png

 
include Win32Lib.ew 
without warning 
 
integer r_Box_onResize 
 
procedure makeEditBox( integer box, integer image, integer edit, object icon ) 
    setUserProperty( box, "Image", image ) 
    setUserProperty( box, "Edit",  edit  ) 
    addStyle( box, {WS_BORDER,WS_EX_CLIENTEDGE} ) 
    removeStyle( edit, {WS_BORDER,WS_EX_CLIENTEDGE} ) 
    setWindowBackColor( image, getSysColor(COLOR_WINDOW) ) 
    setIcon( image, icon ) 
    setHandler( box, w32HResize, r_Box_onResize ) 
end procedure 
 
procedure Box_onResize( integer pSelf, integer pEvent, sequence pParams ) 
 
    object image, edit 
    sequence rect 
     
    image = getUserProperty( pSelf, "Image" ) 
    edit  = getUserProperty( pSelf, "Edit"  ) 
     
    rect = getClientRect( pSelf ) 
    setRect( image[1], 0, 0, 16, rect[4], w32True ) 
    setRect( edit[1], 16, 0, rect[3]-16, rect[4], w32True ) 
 
end procedure 
r_Box_onResize = routine_id("Box_onResize") 
 
constant  
    Main        = create( Window, "EditText w/image", 0, Default, Default, 480, 70, 0 ), 
    Box         = create( Window, "", Main, 0, 0, 0, 0, {WS_CHILD+WS_VISIBLE} ), -- mind your styles here 
    Image       = create( Icon, "", Box, 0, 0, 0, 0, 0 ), 
    Edit        = create( EditText, "", Box, 0, 0, 0, 0, 0 ), 
    Btn         = create( Button, "Click", Main, 0, 0, 0, 0, 0 ) 
     
    makeEditBox( Box, Image, Edit, extractIcon({"pilcrow.ico", 1}) ) 
 
procedure Main_onResize( integer pSelf, integer pEvent, sequence pParams ) 
 
    setRect( Box, 10, 9, {w32Edge,-100}, 22, w32True ) 
    setRect( Btn, {w32AltEdge,-90}, 8, 80, 24, w32True ) 
 
end procedure 
setHandler( Main, w32HResize, routine_id("Main_onResize") ) 
 
procedure Btn_onClick( integer pSelf, integer pEvent, sequence pParams ) 
 
    VOID = message_box( '"' & getText(Edit) & '"', "Text", MB_ICONINFORMATION ) 
 
end procedure 
setHandler( Btn, w32HClick, routine_id("Btn_onClick") ) 
 
WinMain( Main, Normal ) 

Here's the icon I used in the demo: pilcrow.ico

-Greg

Thanks, I think this will help.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu