Start client fullscreen doesn't cover wibox - fullscreen

When a client is started, it should be started fullscreen. I tried to configure this using rules but no matter what I do, the client doesn't cover the wibox.
What I have so far:
function set_fullscreen(c)
mywibox[c.screen].ontop = false
c.fullscreen = false
c.fullscreen = true
c.x = 0
c.y = 0
mywibox[c.screen].ontop = false
c.fullscreen = false
c.fullscreen = true
c.x = 0
c.y = 0
end
awful.rules.rules = {
{ rule = { },
properties = { border_width = beautiful.border_width,
border_color = beautiful.border_normal,
focus = awful.client.focus.filter,
keys = clientkeys,
buttons = clientbuttons } },
{ rule = { class = "<name>" },
properties = { fullscreen = true,
size_hints_honor = false,
focus = true },
callback = set_fullscreen }
}
I have my wibox on the bottom and the application gets painted above the wibox. It also gets painted off-screen above, the size of the wibox. The application seems to have the correct size, but the wibox seems to be in the way.
When I toggle fullscreen for the application, when it is already running, fullscreen works as expected. The application does cover the wibox.
function toggle_fullscreen(c)
c.fullscreen = not c.fullscreen
end
I also have a signal handler that toggles ontop for the wibox when a focussed client's fullscreen property changes:
client.connect_signal("property::fullscreen", function (c)
if c.fullscreen and c == client.focus then
mywibox[c.screen].ontop = false
else
mywibox[c.screen].ontop = true
end
end)
Nothing what I do seems to start the application in fullscreen, I always have to toggle manually. Anybody any idea what I am doing wrong?

client.connect_signal("property::fullscreen", function (c)
if c.fullscreen and c == client.focus then
mywibox[mouse.screen].visible = not mywibox[mouse.screen].visible
else
mywibox[mouse.screen].visible = not mywibox[mouse.screen].visible
end
end)
Work for me.

This should help:
function toggle_fullscreen(c)
c.fullscreen = not c.fullscreen
--TODO store the existing ontop state
c.ontop = c.fullscreen
c:raise()
end

Related

Receive error when double click data in Listbox

I am newbies in VBA. Recently I have created a "Search Form". The search data have 21 columns which will display in the "Search List Box". Unfortunately, it only can show until 9 columns and will return an error for the 10 and above data. Your guidance is very much appreciated. Below is my code:
Private Sub dtlist_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
CDSv1.dptname.Text = CDSv1.dtlist.Column(1)
CDSv1.dptadd.Text = CDSv1.dtlist.Column(2)
CDSv1.divcom.Text = CDSv1.dtlist.Column(3)
CDSv1.ctcname.Text = CDSv1.dtlist.Column(4)
CDSv1.ctcno.Text = CDSv1.dtlist.Column(5)
CDSv1.nid.Text = CDSv1.dtlist.Column(6)
CDSv1.serno.Text = CDSv1.dtlist.Column(7)
CDSv1.ipinfo.Text = CDSv1.dtlist.Column(8)
CDSv1.snet.Text = CDSv1.dtlist.Column(9)
CDSv1.gateway.Text = CDSv1.dtlist.Column(10) '<---- The error starts here.
CDSv1.vlinfo.Text = CDSv1.dtlist.Column(11)
CDSv1.netcatcom.Text = CDSv1.dtlist.Column(12)
CDSv1.netsubcatcom.Text = CDSv1.dtlist.Column(13)
CDSv1.ispcom.Text = CDSv1.dtlist.Column(14)
CDSv1.snscom.Text = CDSv1.dtlist.Column(15)
CDSv1.cirt.Text = CDSv1.dtlist.Column(16)
CDSv1.bdwh.Text = CDSv1.dtlist.Column(17)
CDSv1.statcom.Text = CDSv1.dtlist.Column(18)
CDSv1.remf.Text = CDSv1.dtlist.Column(20)
End Sub

Progress 4GL - Export large amount of data to Excel

Hi there fellow developers,
I'm trying to export a large amount of data to Excel using Progress 4GL. We're talking about ±5500 records and ±170 columns.
The problem is that this is too much for Excel to handle and it raises the following error: Excel error.
I can continue and it exports all the data, but the procedure isn't exactly presentable with an error right in the middle of it.
I'm using the following code to export all data from different CSV files into one single Excel file with a seperate worksheet for each CSV file:
/* Initialize Excel file & add new workbook */
CREATE "Excel.Application" vchExcel.
vchExcel:SheetsInNewWorkbook = NUM-ENTRIES(ipcSheets,',').
vchExcel:WorkBooks:ADD().
ASSIGN vchWorkBook = vchExcel:WorkBooks:Item(1).
/* Import each file's data into a new sheet of the workbook */
Sheet:
DO iTab = 1 TO NUM-ENTRIES(ipcFiles) ON ERROR UNDO, RETRY Sheet:
/* Import CSV data into Excel */
ASSIGN cConnection = SUBSTITUTE("TEXT;" + gvcExportPath + "csv_files\" + "&1",ENTRY(iTab,ipcFiles))
vchWorkSheet = vchExcel:Sheets:ITEM(iTab)
vchWorkSheet:NAME = ENTRY(iTab,ipcSheets)
lResult = vchWorkSheet:QueryTables:ADD(cConnection,vchWorkSheet:cells(1,1)).
ASSIGN
vchQueryTable = vchWorkSheet:QueryTables(1)
vchQueryTable:FieldNames = TRUE
vchQueryTable:RowNumbers = FALSE
vchQueryTable:FillAdjacentFormulas = FALSE
vchQueryTable:PreserveFormatting = FALSE
vchQueryTable:RefreshOnFileOpen = FALSE
vchQueryTable:RefreshStyle = 1
vchQueryTable:SavePassword = FALSE
vchQueryTable:SaveData = TRUE
vchQueryTable:AdjustColumnWidth = TRUE
vchQueryTable:RefreshPeriod = 0
vchQueryTable:TextFilePromptOnRefresh = FALSE
vchQueryTable:TextFilePlatform = 437
vchQueryTable:TextFileStartRow = 1
vchQueryTable:TextFileParseType = 1
vchQueryTable:TextFileTextQualifier = 1
vchQueryTable:TextFileConsecutiveDelimiter = TRUE
vchQueryTable:TextFileTabDelimiter = TRUE
vchQueryTable:TextFileSemicolonDelimiter = TRUE
vchQueryTable:TextFileCommaDelimiter = FALSE
vchQueryTable:TextFileSpaceDelimiter = FALSE
vchQueryTable:TextFileTrailingMinusNumbers = TRUE
lResult = vchQueryTable:REFRESH
vchQueryTable:BackgroundQuery = FALSE.
/* Catch all errors */
CATCH eAnyError AS Progress.Lang.ERROR:
RUN disp_mesg(INPUT SUBSTITUTE("ERROR! -> &1",eAnyError:GetMessage(1))).
RUN adnew_log(INPUT SUBSTITUTE("ERROR OCCURRED!")).
RUN adnew_log(INPUT SUBSTITUTE("=> &1: &2",eAnyError:GetMessageNum(1),eAnyError:GetMessage(1))).
END CATCH.
END.
/* Save & close */
vchExcel:Visible = FALSE.
vchExcel:DisplayAlerts = FALSE.
vchWorkBook:SaveAs(gvcExportPath + ipcName + '.xlsx',,,,,,).
vchWorkBook:CLOSE().
/* Release All Objects */
RELEASE OBJECT vchQueryTable NO-ERROR.
RELEASE OBJECT vchWorkSheet NO-ERROR.
RELEASE OBJECT vchWorkBook NO-ERROR.
vchExcel:QUIT(). /* Quit Excel */
RELEASE OBJECT vchExcel NO-ERROR.
Does any of you know how to solve this issue and get the desired result? Thanks in advance!
Why controlling XL from Progress?
If XL is a mandatory step... I would have rather do it the way around... call XL with a macro-file to open the CSVs and save in XL format.
If this needs to be integrated into a business process... I would just open XL with the macro-file right after the CSVs generation.

Disable/enable an input field

Using this sample code, I am trying to enable/disable the field "arrdatfrom". However, once this text field has been DISABLED, i cannot get it to be re-ENABLED. The function below gets executed when the user clicks a "Refresh" button. I have built this little demo just to prove that I have tried many ways to do this. Any ideas?
function showBooking() {
var d = new Date()
formvals.arrdatefrom = document.getElementById("arrdatfrom").value
formvals.arrdatethru = document.getElementById("arrdatthru").value
formvals.depdatefrom = document.getElementById("depdatfrom").value
formvals.depdatethru = document.getElementById("depdatthru").value
formvals.bookname = document.getElementById("bookname").value
formvals.peakroomfrom = document.getElementById("peakroomfrom").value
formvals.peakroomthru = document.getElementById("peakroomthru").value
formvals.peakattendfrom = document.getElementById("peakattendfrom").value
formvals.peakattendthru = document.getElementById("peakattendthru").value
alert (' ngs.hta ready to enable')
document.getElementById("arrdatfrom").enabled = 'true'
alert ('ngs.hta in showBooking!! disable. ')
document.getElementById("arrdatfrom").disabled = 'true'
...
There is no property .enabled. To re-enable a disabled element, set .disabled = false.

Excel range Style: specifying Borders via VSTO doesn't work

Instead of formatting ranges by setting individual formatting properties one by one, I am trying to use Excel Styles, because it seems to be faster at formatting large numbers of cells. I define a Style once, and then apply it to Ranges like this:
var cell = worksheet.Cells[row, column];
cell.Style = "MyCustomStyle";
It works perfectly for Interior Color and Font, but I am running into weird issues when trying to work with Borders. When I try to define what borders to show on a range, and how they should be formatted, I get unpredictable results, and can't find a way to control it.
The following method creates a Style named ListRowStyle;
private static void CreateListRowStyle(Workbook workbook)
{
var listRowStyle = workbook.Styles.Add(ListRowStyle);
listRowStyle.Interior.Color = ColorTranslator.ToOle(Color.LightGray);
listRowStyle.Font.Color = ColorTranslator.ToOle(Color.DarkBlue);
listRowStyle.Font.Bold = true;
listRowStyle.IncludeBorder = true;
listRowStyle.Borders.Color = ColorTranslator.ToOle(Color.Black);
listRowStyle.Borders.LineStyle = XlLineStyle.xlContinuous;
listRowStyle.Borders.Weight = XlBorderWeight.xlMedium;
}
This creates every single border in the range (vertical, horizontal and diagonal) - so far, so good. However, when I try to display only, say, the top and bottom borders, using the following code, problems start happening:
private static void CreateEditableListRowStyle(Workbook workbook)
{
var editableListRowStyle = workbook.Styles.Add(EditableListRowStyle);
editableListRowStyle.Interior.Color = ColorTranslator.ToOle(Color.Yellow);
editableListRowStyle.Font.Color = ColorTranslator.ToOle(Color.Red);
editableListRowStyle.Font.Bold = false;
editableListRowStyle.IncludeBorder = true;
editableListRowStyle.Borders[XlBordersIndex.xlEdgeLeft].LineStyle = XlLineStyle.xlLineStyleNone;
editableListRowStyle.Borders[XlBordersIndex.xlEdgeRight].LineStyle = XlLineStyle.xlLineStyleNone;
editableListRowStyle.Borders[XlBordersIndex.xlDiagonalDown].LineStyle = XlLineStyle.xlLineStyleNone;
editableListRowStyle.Borders[XlBordersIndex.xlDiagonalUp].LineStyle = XlLineStyle.xlLineStyleNone;
editableListRowStyle.Borders[XlBordersIndex.xlEdgeTop].LineStyle = XlLineStyle.xlContinuous;
editableListRowStyle.Borders[XlBordersIndex.xlEdgeTop].Weight = XlBorderWeight.xlMedium;
editableListRowStyle.Borders[XlBordersIndex.xlEdgeBottom].LineStyle = XlLineStyle.xlContinuous;
editableListRowStyle.Borders[XlBordersIndex.xlEdgeBottom].Weight = XlBorderWeight.xlThin;
}
The color styling happens, but no borders show up. Things get even weirder when I modify the code to format the Left and Right border like this:
private static void CreateEditableListRowStyle(Workbook workbook)
{
var editableListRowStyle = workbook.Styles.Add(EditableListRowStyle);
editableListRowStyle.Interior.Color = ColorTranslator.ToOle(Color.Yellow);
editableListRowStyle.Font.Color = ColorTranslator.ToOle(Color.Red);
editableListRowStyle.Font.Bold = false;
editableListRowStyle.IncludeBorder = true;
editableListRowStyle.Borders[XlBordersIndex.xlEdgeLeft].LineStyle = XlLineStyle.xlContinuous;
editableListRowStyle.Borders[XlBordersIndex.xlEdgeLeft].Weight = XlBorderWeight.xlMedium;
editableListRowStyle.Borders[XlBordersIndex.xlEdgeRight].LineStyle = XlLineStyle.xlContinuous;
editableListRowStyle.Borders[XlBordersIndex.xlEdgeRight].Weight = XlBorderWeight.xlMedium;
editableListRowStyle.Borders[XlBordersIndex.xlDiagonalDown].LineStyle = XlLineStyle.xlLineStyleNone;
editableListRowStyle.Borders[XlBordersIndex.xlDiagonalUp].LineStyle = XlLineStyle.xlLineStyleNone;
editableListRowStyle.Borders[XlBordersIndex.xlEdgeTop].LineStyle = XlLineStyle.xlContinuous;
editableListRowStyle.Borders[XlBordersIndex.xlEdgeTop].Weight = XlBorderWeight.xlMedium;
editableListRowStyle.Borders[XlBordersIndex.xlEdgeBottom].LineStyle = XlLineStyle.xlContinuous;
editableListRowStyle.Borders[XlBordersIndex.xlEdgeBottom].Weight = XlBorderWeight.xlThin;
}
At that point, the top and bottom borders still don't show up; on the other hand, I get a Left border that shows up, but no Right border. Uh?
So - am I doing something wrong, or is setting Borders on a Style via VSTO just not working? Note that the following code, which is a very close translation of the VSTO/C# code in VBA, works exactly as I would expect it to.
Sub Styling()
ActiveWorkbook.Styles.Add Name:="VbaStyle"
With ActiveWorkbook.Styles("VbaStyle")
.IncludeBorder = True
End With
ActiveWorkbook.Styles("VbaStyle").Borders(xlLeft).LineStyle = xlNone
ActiveWorkbook.Styles("VbaStyle").Borders(xlRight).LineStyle = xlNone
ActiveWorkbook.Styles("VbaStyle").Borders(xlDiagonalDown).LineStyle = xlNone
ActiveWorkbook.Styles("VbaStyle").Borders(xlDiagonalUp).LineStyle = xlNone
With ActiveWorkbook.Styles("VbaStyle").Borders(xlTop)
.LineStyle = xlContinuous
.Weight = xlMedium
End With
With ActiveWorkbook.Styles("VbaStyle").Borders(xlBottom)
.LineStyle = xlContinuous
.Weight = xlThin
End With
End Sub
This is on Windows 7, Excel 2007.
Try using xlLeft, xlRight, xlTop, xlBottom instead of xlEdgeLeft, xlEdgeRight, xlEdgeTop, xlEdgeBottom
I was trying for sometime and came across your question and got some heads-up.
Thanks for that.
Was able to create the style using the optional parameter of basedOn like below:
var activeSheet = workbook.ActiveSheet as Worksheet;
Range first = activeSheet.Range["A1"];
first.Borders.Item[XlBordersIndex.xlEdgeBottom].Color = Color.FromArgb(0, 16, 80);
first.Borders.Item[XlBordersIndex.xlEdgeBottom].Weight = XlBorderWeight.xlThick;
first.Borders.Item[XlBordersIndex.xlEdgeBottom].LineStyle = XlLineStyle.xlContinuous;
Style myStyle = o9Workbook.Styles.Add("MyStyle",first);
//reset the first to normal style
first.Style = "Normal";
Hope it helps someone!

Display balloon tooltip in systemtray

this is my code..
set trayicon
.......
NOTIFYICONDATA data;//this is global variable.
case WM_CREATE :
data.cbSize = sizeof(NOTIFYICONDATA);
data.hWnd =hWnd;
data.uID = IDR_MAINFRAME;
data.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
data.uCallbackMessage = ID_TRAYICON_NOTIFY;
data.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_INFO));
wcscpy_s(data.szTip,128,a);
Shell_NotifyIcon( NIM_ADD, &data );
........
and set balloon
......
case WM_RBUTTONDBLCLK:
data.hWnd = hWnd;
data.cbSize =sizeof(NOTIFYICONDATA);
data.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_INFO));
data.uTimeout = 5000;
data.uFlags = NIF_INFO;
data.dwInfoFlags = NIIF_INFO;
_tcscpy_s(data.szInfoTitle,_T("TITLE"));
_tcscpy_s(data.szInfo,_T("SOME TEXT"));
Shell_NotifyIcon(NIM_MODIFY,&data);
.......
but, can't show balloon tooltip
plz teach me.
You should check shell32.dll version, and set cbSize to (as described in the Remarks section of the NOTIFYICONDATA docs):
sizeof(NOTIFYICONDATA) if version is >=6.0.6
NOTIFYICONDATA_V3_SIZE if version is 6.0 (WinXP)
NOTIFYICONDATA_V2_SIZE if version is 5.0 (Win2000)
NOTIFYICONDATA_V1_SIZE if version is <5.0 (NT4/95/98)
I found the code in the official docs for detecting windows versions wasn't quite right.
This should work better:
Try this for size (literally):
BOOL CheckWindowsVersion(DWORD dwMajor, DWORD dwMinor, DWORD dwBuild)
{
// Initialize the OSVERSIONINFOEX structure.
OSVERSIONINFOEX osvi;
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
osvi.dwMajorVersion = dwMajor;
osvi.dwMinorVersion = dwMinor;
osvi.dwBuildNumber = dwBuild;
// Initialize the condition mask.
DWORDLONG dwlConditionMask = 0;
VER_SET_CONDITION(dwlConditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL);
VER_SET_CONDITION(dwlConditionMask, VER_MINORVERSION, VER_GREATER_EQUAL);
VER_SET_CONDITION(dwlConditionMask, VER_BUILDNUMBER, VER_GREATER_EQUAL);
// Perform the test.
return VerifyVersionInfo(&osvi, VER_MAJORVERSION | VER_MINORVERSION | VER_BUILDNUMBER, dwlConditionMask);
}
Then when you want to set the icon you can test for the correct windows version. For some reason in the official docs they were only checking for 6.1, when it should be 6.0.6 + all the other windows versions...
if( CheckWindowsVersion(6, 0, 6))
data.cbSize = sizeof(NOTIFYICONDATA);
else if( CheckWindowsVersion(6, 0, 0))
data.cbSize = NOTIFYICONDATA_V3_SIZE;
else if( CheckWindowsVersion(5, 0, 0))
data.cbSize = NOTIFYICONDATA_V2_SIZE;
else
data.cbSize = NOTIFYICONDATA_V1_SIZE;
I didn't fully test the VER_BUILDNUMBER part yet, but I presume this must be close.

Resources