View Full Version : How To Stop
gungadout
10-09-2010, 07:06
Hi Folks,
I set up a multi-line text box (%txtReportBody) as shown below. It fills the full width of the program's display window.
It works well.
However, when the vertical slide bar is first clicked on, the whole %txtReportBody text box (including the slide bar) turns blue, and stays that way until the %txtReportBody text box data is clicked. This happens whether or not the slide bar is actually active.
The same thing happens if I click on the window area below the text box.
(FYI, If I click above the text box (i.e. in %txtReportHeading, another text box), nothing happens in %txtReportHeading, but %txtReportBody turns blue momentarily, then redislays normally.
If I click in the body of %txtReportBody, it appears to turn blue momentarily, then redislays normally, but more quickly than when clicking in %txtReportBody.)
Is there any way I can stop the %txtReportBody's turning blue (i.e. changing colour)?
Thanks,
Peter H. (gungadout)
' report controls
%txtReportHeading
%txtReportBody
%txtReportFooting
.
.
Control Add Textbox , hDlgReport, %txtReportBody, "" , 0, 71, 850, 340, %WS_BORDER Or _
%WS_TABSTOP Or _
%ES_WANTRETURN Or _
%ES_MULTILINE Or _
%ES_AUTOHSCROLL Or _
%ES_AUTOVSCROLL Or _
%WS_VSCROLL Or _
%WS_HSCROLL, _
%WS_EX_CLIENTEDGE
Static hFont2 As DWord Resource '---With Resource you will instruct thinBasic to automatically release hFont resource when done
hFont2 = Font_Create("Courier New" , 10) '---Select a mono space font
Control Send hDlgReport, %txtReportBody, %WM_SETFONT, hFont2, 0
Background = Rgb(360, 340, 240)
Control Set Color hDlgReport, %txtReportBody, -1, Background
.
.
Control Set Text hDlgReport, %txtReportBody, Buffer
gungadout
10-09-2010, 07:08
Part of the topic heading got lost.
It originally said, How To Stop Automatic Colour Change In Text Box.
ErosOlmi
10-09-2010, 11:16
Sorry but I do not understand what's going on.
Attached a working script example we can use to try to replicate your problem.
Can you modify it so I can replicate here the same situation?
Thanks
Eros
gungadout
13-09-2010, 09:52
Hi Eros,
Thanks for your reply and for the example.
I cannot really change the example you sent, to replicate the problem, because I don't know what is causing the problem.
I have attached a document with some screen dumps to show what is happening. It also contains the relevant source code.
I do not yet fully understand the significance of all the Add Textbox parameters, so I would appreciate your having a quick look at the parameters I have used, to see if there is a problem.
Regards,
Peter H. 9gungadout)
Petr Schreiber
13-09-2010, 10:53
Hi,
I think the blue is caused by selection of the whole textbox. You can reset the selection by:
Control Send CBHNDL, <controlIDHere>, %EM_SETSEL, 0, 0
... but I am not sure why is this all happening.
Are you sure the control IDs are unique?
Petr
gungadout
13-09-2010, 14:12
Hi Peter,
Thanks for your reply.
My control IDs should be unique, because I believe I have defined them so.
With respect to the instruction you suggested, I have tried 4 variations, as the first instruction in the CallBack Function cbDialogReport():
Control Send CBHNDL, <hDlgReport>, %EM_SETSEL, 0, 0
Control Send hDlgReport, <%txtReportBody>, %EM_SETSEL, 0, 0
Control Send CBHNDL, <%txtReportBody>, %EM_SETSEL, 0, 0
Control Send ScreenId03, <%txtReportBody>, %EM_SETSEL, 0, 0
Each one has produced an error popup at run time. Each popup nominated the first parameter (CBHNDL, hDlgReport, CBHNDL and ScreenId03, respectively) as the offender.
I also tried the instructions in Function DisplayReport() just in case, but I did not expect them to work there.
(Bear in mind that I define all my variables as global to tha whole program. I do that so that I never have to worry about whether or not they are defined in any given function.)
If it's not too much to ask, I think I need you to indicate exactly where the statement should be placed in the code segment I sent, and expressed using the variables in that code segment.
Thanks for your help so far.
Regards,
Peter H. (gungadout)
Michael Hartlef
13-09-2010, 15:08
Each one has produced an error popup at run time. Each popup nominated the first parameter (CBHNDL, hDlgReport, CBHNDL and ScreenId03, respectively) as the offender.
remove the < and > from your code. Petr example just to showed where your ID has to go. The ID has to be a variable or an equate. They never start and end with < and > .
Petr Schreiber
13-09-2010, 15:57
Mike is right,
the <, > have been used only to mark the position.
I did not get your example running thanks to its dependancy on other code, so cannot find where exactly this would be the most effective. In any case, what I suggested is workaround, the reason is still kind of unknown to me.
I think you could try to put that into textbox message handling first and then try to isolate the cases.
CallBack Function cbDialogReport()
Select Case Callback_Message
Case %WM_COMMAND ' PEH this checks if it is an ordinary command, like a button press.
' -- Handling multiple buttons
Select Case Callback_Control
Case %btnExit
' -- Test if it was clicked - No need. It was - test only needed if special callback written for button
Dialog End hDlgReport
Case %txtReportBody
Control Send CBHNDL, %txtReportBody, %EM_SETSEL, 0, 0
End Select
Case %WM_CLOSE
' -- Add here some de-initialization if needed
Exit Function
End Select
End Function
Petr
gungadout
14-09-2010, 09:16
Thanks Michael and Petr.
Petr, your construction successfully removed the main problem.
Now, wherever I click in the screen, the result is consistent. The window background flashes blue, but immediately returns to its proper colour.
It would be good if I could remove the momentary blue flash, but what is happening now is heaps better than what was happening before.
Thanks again,
Peter H. (gungadout)
Petr Schreiber
14-09-2010, 09:44
Hi,
I still find the automatic selection very mysterious. Don't you send some message to wrong control or something? This problem never occured to me.
Petr
zlatkoAB
14-09-2010, 20:06
Weird i download source code from zip file and this program
dont wanna run on my computer?
is this source code complet or something else..?
Michael Hartlef
14-09-2010, 20:47
Its not complete, that is why it is difficult to help.
zlatkoAB
15-09-2010, 11:38
Yes Mike i see now...
gungadout
19-09-2010, 15:43
Hi Folks,
Thanks for your continuing interest.
I don't want to post the whole thinBasic program because it is already 1800 lines long, and it won't run anyway, unless you have a particular multi-dimensional database to connect to, and the set of programs that run within that database and which talk to the thinBasic front end.
I'm concentrating on adding functionality to the thinBasic-database interaction now. That includes automatically converting complex character-based 4GL database programs into programs which will use thinBasic as their front end. Once I've achieved that, I'll embark upon a brush-and-pan clean up exercise, which will include revisiting this problem and nailing it down once and for all.
I may find, for instance, that I should have just <CR> or just <LF> as line delimiters within the text box, instead of the <CR><LF> that I now have.
Anyway, time will tell when I get around to experimenting.
Thanks again for all your help.
Regards,
Peter H. (gungadout)