• Welcome to PlanetSquires Forums.
 

Change Text Control Style AFTER creation

Started by Mark Strickland, November 11, 2007, 02:29:38 AM

Previous topic - Next topic

Mark Strickland

I read in another post that it is not possible to change some of the styles (Left/Center/Right) on a control.

What would be the easiest way to destroy and re-create the control?  Can I copy the chunk of code in the generated output to recreate the control?  Will all of the event functions still work if the control is recreated with the same name?  My guess is the code pointers would be wrong.

I just want to change the Left/Right justification on the fly.

What should be easy now seems very hard.   :(

Thanks

TechSupport

Yeah, I don't think that this would be too easy to do. You could try creating the TextBox yourself via CreateWindowEX and position it in your code and handle the events yourself. Kind of defeats the purpose of using FireFly in the first place. If it is only one or two TextBoxes that you need to change alignment then maybe an option would be to have a second TextBox set to the other alignment and set its WS_VISIBLE to off. When you need to change alignment, simply hide the current TextBox, get the text via FF_TextBox_GetText and  set the other alignment TextBox's Text to that text. Then, move the new alignment TextBox into the same position when the current TextBox is and then show it (i.e.  ShowWindow hWndControl, %SW_SHOWNORMAL ). Write your event handlers for these two alignment windows so that the code is shared between them.

Confused?




Mark Strickland

No confusion --- over this anyway  ;)

I had arrived at about the same conclusion of hiding and showing textbox pairs.  I may elect to just live with a numeric field being left aligned.

Another example of the "simple being hard".   :P

Thanks